react-semaphor 0.1.559 → 0.1.561

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.
Files changed (168) hide show
  1. package/dist/analytics-protocol/index.js +389 -378
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/analytics-base-schemas-CB3oFAXk.js +658 -0
  7. package/dist/chunks/{assistant-chat-B_4bVE6I.js → assistant-chat-DiVHY3Hw.js} +209 -211
  8. package/dist/chunks/bookmark-impact-CR09dpkn.js +75 -0
  9. package/dist/chunks/bookmark-state-BusLpkb7.js +743 -0
  10. package/dist/chunks/{braces-Rdxa3H-s.js → braces-u8VorWJc.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-CKzQ5LcF.js → comparison-window-caption-DDsIWJYT.js} +201 -201
  12. package/dist/chunks/{context-DVy4HOU0.js → context-TUjw9eqr.js} +1 -1
  13. package/dist/chunks/{custom-visual-inputs-zVa9wX_o.js → custom-visual-inputs-DfolidZ9.js} +1 -1
  14. package/dist/chunks/{dashboard-BziwOVpZ.js → dashboard-BRdZBPqr.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CbeNR-YI.js → dashboard-briefing-launcher-CgvTLndW.js} +1163 -1178
  16. package/dist/chunks/{dashboard-controls-RD6UJs1r.js → dashboard-controls-B4vfSzTF.js} +877 -941
  17. package/dist/chunks/{dashboard-json-DGpv17vL.js → dashboard-json-Y3MF59g7.js} +5 -5
  18. package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +1718 -0
  19. package/dist/chunks/{edit-dashboard-visual-AQ2pQkFp.js → edit-dashboard-visual-DwjZcxj-.js} +9080 -9354
  20. package/dist/chunks/filter-reach-copy-bijwf_-b.js +3596 -0
  21. package/dist/chunks/{filter-value-text-B4l-xqJT.js → filter-value-text-DFnhwuEW.js} +3 -3
  22. package/dist/chunks/global-date-filter-utils-BXgCpvQM.js +15142 -0
  23. package/dist/chunks/{index-B1Xr7W24.js → index-ClwbY3BL.js} +648 -674
  24. package/dist/chunks/{layout-grid-Bbz3zKif.js → layout-grid-CtvCBfOm.js} +1 -1
  25. package/dist/chunks/{list-filter-3sbH0Uy1.js → list-filter-BklYgciR.js} +1 -1
  26. package/dist/chunks/{matrix-analytical-definition-CEe3PGEo.js → matrix-analytical-definition-pU51-JmY.js} +4 -4
  27. package/dist/chunks/{matrix-card-BRNGb1C4.js → matrix-card-CUorIB7Q.js} +3 -3
  28. package/dist/chunks/{matrix-member-presentation-CEegvTqg.js → matrix-member-presentation-Df5UgCGN.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-COxrfQTS.js → matrix-operation-contract-BSiGEXVC.js} +221 -214
  30. package/dist/chunks/{metric-comparison-DQx-uX__.js → metric-comparison-95aC0uEO.js} +6 -6
  31. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-B5wQhg5G.js} +1 -1
  32. package/dist/chunks/{palette-DMJtp3Vn.js → palette-DTnMhipt.js} +1 -1
  33. package/dist/chunks/pivot-result-contract-expectations-Bo-86vwS.js +56 -0
  34. package/dist/chunks/{pivot-result-identity-CAj8SiRL.js → pivot-result-identity-olvXJoB9.js} +1 -1
  35. package/dist/chunks/{report-preferences-dialog-0sc8B1lh.js → report-preferences-dialog-C2YUIwKG.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-bYoExeWr.js → report-runtime-context-DoIUr3MP.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-q_iiNXE1.js +6503 -0
  38. package/dist/chunks/{save-DSb1jTtG.js → save-DH4RyrnG.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-BQWM3ldX.js → saved-dashboard-context-8jqfI7hI.js} +59 -59
  40. package/dist/chunks/{selection-reducer-DSzMWb4x.js → selection-reducer-CV7K4FI6.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-Bz14Oma5.js → semaphor-ready-indicator-E2XWyibu.js} +40105 -41658
  42. package/dist/chunks/{shelf-drop-preview-context-DBHAkgch.js → shelf-drop-preview-context-C29EUzDp.js} +570 -570
  43. package/dist/chunks/{source-entity-resolution-BOrmNCEM.js → source-entity-resolution-BXI3nQ5Z.js} +1 -1
  44. package/dist/chunks/{switch-Dq8XPFpT.js → switch-balDSHc7.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-C_RvEUyO.js → table-export-sheet-CK8tvh4d.js} +1 -1
  46. package/dist/chunks/temporal-input-presentation-B77JsAzU.js +5002 -0
  47. package/dist/chunks/{token-types-LCYMJ3pa.js → token-types-DhYH5YKb.js} +1 -1
  48. package/dist/chunks/{upload-Dr_WAxHQ.js → upload-Ufj8vjyn.js} +1 -1
  49. package/dist/chunks/{use-create-flow-overlay-state-BK3YFkfc.js → use-create-flow-overlay-state-9WsnzEO5.js} +6 -6
  50. package/dist/chunks/{validators-C87JPd-_.js → validators-BtaCFIEB.js} +1206 -1579
  51. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-CGLVI40Q.js} +1 -1
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2713 -1459
  54. package/dist/data-app-sdk/index.js +20 -20
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +10 -10
  57. package/dist/format-utils/index.js +262 -256
  58. package/dist/index.js +214 -215
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  63. package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
  64. package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
  65. package/dist/types/index.js +50 -51
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  68. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  69. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  70. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  71. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  72. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  73. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  74. package/dist/types/lib/stores/editor-store.d.ts +48 -10
  75. package/dist/types/lib/stores/table-actions.d.ts +9 -5
  76. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  79. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  80. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  81. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  82. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  83. package/dist/types/lib/types/common-types.d.ts +40 -47
  84. package/dist/types/lib/types/explorer-types.d.ts +11 -43
  85. package/dist/types/lib/utils/card-config-utils.d.ts +8 -0
  86. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  87. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +169 -513
  88. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  89. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  90. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  91. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  92. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  93. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  94. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  95. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  96. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  97. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  98. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  99. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  100. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  101. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  102. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  103. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  104. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  105. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +52 -0
  106. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  107. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  108. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  109. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  110. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  111. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  112. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  113. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +15 -0
  114. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +102 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  117. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +40 -0
  119. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +28 -0
  120. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  121. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  122. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +555 -38
  123. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +27 -8
  124. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +25 -1
  125. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  126. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  127. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  128. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +7 -0
  129. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  130. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  131. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  132. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  133. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  134. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  135. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  136. package/dist/types/shared/dashboard-authoring/index.d.ts +8 -0
  137. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  138. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  139. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  140. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +21 -1
  141. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +10 -4
  142. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  143. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  144. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  145. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +13 -2
  146. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  147. package/dist/types/shared/format-utils/index.d.ts +2 -0
  148. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  149. package/dist/types/shared/format-utils/raw-temporal.d.ts +31 -1
  150. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  151. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  152. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  153. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  154. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  155. package/package.json +2 -2
  156. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  157. package/dist/chunks/bookmark-state-ssqrs5oP.js +0 -111
  158. package/dist/chunks/document-dashboard-inputs-ChVkcBuu.js +0 -3010
  159. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  160. package/dist/chunks/filter-reach-copy-B5Y7FHzg.js +0 -3411
  161. package/dist/chunks/global-date-filter-utils-DBzEOX9M.js +0 -12222
  162. package/dist/chunks/pivot-result-contract-expectations-DOYhqeZb.js +0 -1926
  163. package/dist/chunks/raw-temporal-presentation-BmT7z6NH.js +0 -584
  164. package/dist/chunks/resolve-dashboard-input-context-B_C_VAJH.js +0 -5520
  165. package/dist/chunks/table-settings-DXj_zXwS.js +0 -637
  166. package/dist/chunks/temporal-input-presentation-AhLSkGPf.js +0 -2939
  167. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  168. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -0,0 +1,658 @@
1
+ import { z as e } from "zod";
2
+ const P = [
3
+ "missing_dependency",
4
+ "missing_relationship",
5
+ "population_required",
6
+ "ambiguous_relationship"
7
+ ];
8
+ function ve(t) {
9
+ return P.includes(
10
+ t
11
+ );
12
+ }
13
+ const Re = 200, D = [
14
+ "second",
15
+ "minute",
16
+ "hour",
17
+ "day",
18
+ "week",
19
+ "month",
20
+ "quarter",
21
+ "year"
22
+ ];
23
+ function Te(t) {
24
+ return typeof t == "string" && D.includes(t);
25
+ }
26
+ const Z = [
27
+ "week_of_short",
28
+ "week_of_long",
29
+ "quarter_short",
30
+ "quarter_long",
31
+ "fiscal_quarter_short",
32
+ "fiscal_year",
33
+ // Named presets per grain (column formats CF-D16).
34
+ "short",
35
+ "long",
36
+ "numeric",
37
+ "iso"
38
+ ], ke = {
39
+ invalidMetadata: "invalid_raw_temporal_metadata"
40
+ };
41
+ function B(t) {
42
+ return t === "second" || t === "minute" || t === "hour" ? "datetime" : "date";
43
+ }
44
+ const xe = {
45
+ missingMetadata: "missing_temporal_bucket_metadata",
46
+ invalidMetadata: "invalid_temporal_bucket_metadata",
47
+ invalidValue: "invalid_temporal_bucket_value"
48
+ }, Ie = "__auto_count__";
49
+ function G(t) {
50
+ try {
51
+ return new Intl.DateTimeFormat("en-US", { timeZone: t }).format(), !0;
52
+ } catch {
53
+ return !1;
54
+ }
55
+ }
56
+ const z = 20;
57
+ function d(t) {
58
+ if (!(typeof t != "number" || !Number.isFinite(t)))
59
+ return Math.max(0, Math.min(z, Math.trunc(t)));
60
+ }
61
+ function s(t) {
62
+ return typeof t == "string" ? t : void 0;
63
+ }
64
+ function S(t) {
65
+ return typeof t == "string" && t.trim() ? t : void 0;
66
+ }
67
+ function _(t) {
68
+ return typeof t == "boolean" ? t : void 0;
69
+ }
70
+ function L(t) {
71
+ if (typeof t != "string") return;
72
+ const a = t.trim().toUpperCase();
73
+ return /^[A-Z]{3}$/.test(a) ? a : void 0;
74
+ }
75
+ function $(t) {
76
+ return typeof t == "number" && Number.isFinite(t) ? t : void 0;
77
+ }
78
+ function c(t) {
79
+ return Object.fromEntries(
80
+ Object.entries(t).filter(([, a]) => a !== void 0)
81
+ );
82
+ }
83
+ const H = /* @__PURE__ */ new Set(["number", "currency", "percent", "percentage", "scientific"]), K = /* @__PURE__ */ new Set(["millisecond", "second", "minute", "hour", "day"]);
84
+ function v(t) {
85
+ return typeof t == "string" && K.has(t) ? t : void 0;
86
+ }
87
+ function W(t) {
88
+ const a = t.percentValueMode ?? "fraction";
89
+ if (t.scale === 1 && a === "whole") {
90
+ const { scale: i, ...b } = t;
91
+ return { ...b, percentValueMode: "whole" };
92
+ }
93
+ const o = t.minimumFractionDigits ?? (t.maximumFractionDigits === void 0 ? 1 : 0), n = t.maximumFractionDigits ?? Math.max(o, 1);
94
+ return c({
95
+ type: "number",
96
+ scale: a === "whole" ? t.scale : t.scale * 100,
97
+ minimumFractionDigits: o,
98
+ maximumFractionDigits: n,
99
+ useGrouping: t.useGrouping,
100
+ prefix: t.prefix,
101
+ suffix: `%${t.suffix ?? ""}`,
102
+ negativeStyle: t.negativeStyle,
103
+ signDisplay: t.signDisplay
104
+ });
105
+ }
106
+ function X(t) {
107
+ const a = t.type === "percentage" ? "percent" : t.type;
108
+ let o = d(t.minimumFractionDigits), n = d(t.maximumFractionDigits);
109
+ const i = d(t.decimals);
110
+ o === void 0 && n === void 0 && i !== void 0 && (o = i, n = i), o !== void 0 && n !== void 0 && o > n && ([o, n] = [n, o]);
111
+ const b = t.negativeStyle === "parentheses" || t.negativeStyle === "minus" ? t.negativeStyle : void 0, q = t.signDisplay === "auto" || t.signDisplay === "always" || t.signDisplay === "exceptZero" || t.signDisplay === "never" ? t.signDisplay : void 0, m = c({
112
+ type: a,
113
+ currency: a === "currency" ? L(t.currency) : void 0,
114
+ minimumFractionDigits: o,
115
+ maximumFractionDigits: n,
116
+ useGrouping: _(t.useGrouping) ?? _(t.thousandsSeparator),
117
+ prefix: s(t.prefix),
118
+ // Intl adds the % of a percent; a stored '%' suffix on one is the same sign.
119
+ suffix: a === "percent" && t.suffix === "%" ? void 0 : s(t.suffix),
120
+ negativeStyle: b,
121
+ compact: _(t.compact),
122
+ scale: $(t.scale),
123
+ percentValueMode: a === "percent" ? t.percentValueMode === "whole" ? "whole" : "fraction" : void 0,
124
+ signDisplay: q
125
+ });
126
+ return m.type === "percent" && m.scale !== void 0 ? W(m) : m;
127
+ }
128
+ function Y(t) {
129
+ if (!t || typeof t != "object" || Array.isArray(t)) return;
130
+ const a = t;
131
+ if (a.type === "temporal_bucket") {
132
+ const o = a.presentation;
133
+ return o && typeof o == "object" && !Array.isArray(o) ? { type: "temporal_bucket", presentation: o } : void 0;
134
+ }
135
+ if (typeof a.type == "string" && H.has(a.type))
136
+ return X(a);
137
+ if (a.type === "date" || a.type === "datetime") {
138
+ const o = S(a.pattern), n = a.preset === "short" || a.preset === "long" || a.preset === "numeric" || a.preset === "iso" ? a.preset : void 0, i = o && (a.dialect === "date_fns" || a.dialect === "semaphor_tokens") ? a.dialect : void 0;
139
+ return c({
140
+ type: "date",
141
+ pattern: o,
142
+ dialect: i,
143
+ preset: o ? void 0 : n,
144
+ relative: a.relative === !0 ? !0 : void 0,
145
+ timezone: S(a.timezone),
146
+ sourceTimezone: S(a.sourceTimezone),
147
+ prefix: s(a.prefix),
148
+ suffix: s(a.suffix)
149
+ });
150
+ }
151
+ if (a.type === "duration") {
152
+ const o = d(a.maxUnits);
153
+ return c({
154
+ type: "duration",
155
+ inputUnit: v(a.inputUnit),
156
+ outputStyle: a.outputStyle === "compact" || a.outputStyle === "digital" || a.outputStyle === "long" ? a.outputStyle : void 0,
157
+ largestUnit: v(a.largestUnit),
158
+ smallestUnit: v(a.smallestUnit),
159
+ maxUnits: o === void 0 ? void 0 : Math.min(o, 10),
160
+ prefix: s(a.prefix),
161
+ suffix: s(a.suffix),
162
+ negativeStyle: a.negativeStyle === "parentheses" || a.negativeStyle === "minus" ? a.negativeStyle : void 0
163
+ });
164
+ }
165
+ if (a.type === "string")
166
+ return c({ type: "string", prefix: s(a.prefix), suffix: s(a.suffix) });
167
+ }
168
+ const J = e.record(e.string(), e.unknown()), p = e.array(J), u = e.enum([
169
+ "SUM",
170
+ "COUNT",
171
+ "AVG",
172
+ "MIN",
173
+ "MAX",
174
+ "MEDIAN",
175
+ "DISTINCT"
176
+ ]), g = e.enum([
177
+ "postgres",
178
+ "mysql",
179
+ "mssql",
180
+ "snowflake",
181
+ "clickhouse",
182
+ "bigquery",
183
+ "redshift",
184
+ "duckdb",
185
+ "sqlite",
186
+ "unknown"
187
+ ]), Q = e.enum(D), h = e.enum([
188
+ "dimension",
189
+ "measure",
190
+ "date",
191
+ "id",
192
+ "unknown"
193
+ ]), y = e.enum([
194
+ "string",
195
+ "number",
196
+ "boolean",
197
+ "date",
198
+ "datetime",
199
+ "unknown"
200
+ ]), R = e.union([e.number(), e.string(), e.null()]), T = e.enum([
201
+ "millisecond",
202
+ "second",
203
+ "minute",
204
+ "hour",
205
+ "day"
206
+ ]), ee = e.enum(Z), te = e.discriminatedUnion("mode", [
207
+ e.object({ mode: e.literal("auto") }).strict(),
208
+ e.object({
209
+ mode: e.literal("preset"),
210
+ preset: ee
211
+ }).strict(),
212
+ e.object({
213
+ mode: e.literal("pattern"),
214
+ pattern: e.string().min(1)
215
+ }).strict()
216
+ ]), j = e.object({
217
+ type: e.literal("temporal_bucket"),
218
+ presentation: te
219
+ }).strict(), ae = e.object({
220
+ tz: e.string().min(1).refine(G, {
221
+ message: "tz must be a valid IANA timezone"
222
+ }),
223
+ weekStart: e.number().int().min(0).max(6),
224
+ fiscalCalendar: e.object({
225
+ kind: e.literal("month_aligned"),
226
+ yearStartMonth: e.number().int().min(1).max(12)
227
+ }).strict().optional()
228
+ }).strict(), k = e.object({
229
+ kind: e.literal("temporal_bucket"),
230
+ granularity: Q,
231
+ calendar: ae
232
+ }).strict(), oe = e.object({
233
+ kind: e.literal("raw_temporal"),
234
+ valueKind: e.enum(["date", "wall_datetime", "instant"])
235
+ }).strict(), r = e.string(), x = e.number().int().min(0).max(20), w = e.object({
236
+ type: e.enum(["number", "currency", "percent", "scientific"]),
237
+ currency: e.string().regex(/^[A-Z]{3}$/, "Expected an ISO 4217 currency code.").optional(),
238
+ minimumFractionDigits: x.optional(),
239
+ maximumFractionDigits: x.optional(),
240
+ useGrouping: e.boolean().optional(),
241
+ prefix: r.optional(),
242
+ suffix: r.optional(),
243
+ negativeStyle: e.enum(["minus", "parentheses"]).optional(),
244
+ compact: e.boolean().optional(),
245
+ scale: e.number().finite().optional(),
246
+ percentValueMode: e.enum(["fraction", "whole"]).optional(),
247
+ signDisplay: e.enum(["auto", "always", "exceptZero", "never"]).optional()
248
+ }).strict().superRefine((t, a) => {
249
+ const { minimumFractionDigits: o, maximumFractionDigits: n } = t;
250
+ o !== void 0 && n !== void 0 && o > n && a.addIssue({
251
+ code: e.ZodIssueCode.custom,
252
+ path: ["minimumFractionDigits"],
253
+ message: "minimumFractionDigits must not exceed maximumFractionDigits."
254
+ }), t.currency !== void 0 && t.type !== "currency" && a.addIssue({
255
+ code: e.ZodIssueCode.custom,
256
+ path: ["currency"],
257
+ message: "Only a currency format names a currency."
258
+ }), t.type === "percent" ? (t.percentValueMode === void 0 && a.addIssue({
259
+ code: e.ZodIssueCode.custom,
260
+ path: ["percentValueMode"],
261
+ message: "A percent format states percentValueMode: fraction (0.25 is 25%) or whole (25 is 25%)."
262
+ }), t.scale !== void 0 && a.addIssue({
263
+ code: e.ZodIssueCode.custom,
264
+ path: ["scale"],
265
+ message: "A percent format has no scale; percentValueMode says how the value is read."
266
+ })) : t.percentValueMode !== void 0 && a.addIssue({
267
+ code: e.ZodIssueCode.custom,
268
+ path: ["percentValueMode"],
269
+ message: "Only a percent format has percentValueMode."
270
+ });
271
+ }), ne = ["short", "long", "numeric", "iso"], F = e.object({
272
+ type: e.literal("date"),
273
+ pattern: e.string().min(1).optional(),
274
+ dialect: e.enum(["semaphor_tokens", "date_fns"]).optional(),
275
+ preset: e.enum(ne).optional(),
276
+ relative: e.boolean().optional(),
277
+ timezone: e.string().min(1).optional(),
278
+ sourceTimezone: e.string().min(1).optional(),
279
+ prefix: r.optional(),
280
+ suffix: r.optional()
281
+ }).strict().superRefine((t, a) => {
282
+ t.pattern !== void 0 && t.preset !== void 0 && a.addIssue({
283
+ code: e.ZodIssueCode.custom,
284
+ path: ["preset"],
285
+ message: "A date format has a pattern or a preset, not both."
286
+ }), t.dialect !== void 0 && t.pattern === void 0 && a.addIssue({
287
+ code: e.ZodIssueCode.custom,
288
+ path: ["dialect"],
289
+ message: "dialect names the token set of a pattern."
290
+ });
291
+ }), A = e.object({
292
+ type: e.literal("duration"),
293
+ inputUnit: T.optional(),
294
+ outputStyle: e.enum(["compact", "digital", "long"]).optional(),
295
+ largestUnit: T.optional(),
296
+ smallestUnit: T.optional(),
297
+ maxUnits: e.number().int().min(0).max(10).optional(),
298
+ prefix: r.optional(),
299
+ suffix: r.optional(),
300
+ negativeStyle: e.enum(["minus", "parentheses"]).optional()
301
+ }).strict(), M = e.object({
302
+ type: e.literal("string"),
303
+ prefix: r.optional(),
304
+ suffix: r.optional()
305
+ }).strict(), C = e.union([
306
+ w,
307
+ F,
308
+ A,
309
+ M
310
+ ]), ie = e.unknown().superRefine((t, a) => {
311
+ t && typeof t == "object" && "locale" in t && ["number", "currency", "percent", "percentage", "scientific"].includes(
312
+ String(t.type)
313
+ ) && a.addIssue({
314
+ code: e.ZodIssueCode.custom,
315
+ path: ["locale"],
316
+ message: "Numeric semantic formats inherit locale from viewer preferences."
317
+ });
318
+ }).transform((t) => Y(t) ?? t).pipe(C), De = e.union([
319
+ C,
320
+ j
321
+ ]), je = ["number", "currency", "percent", "scientific", "duration", "date", "string", "temporal_bucket"];
322
+ function se(t) {
323
+ switch (t) {
324
+ case "number":
325
+ case "currency":
326
+ case "percent":
327
+ case "scientific":
328
+ return w;
329
+ case "date":
330
+ return F;
331
+ case "duration":
332
+ return A;
333
+ case "string":
334
+ return M;
335
+ case "temporal_bucket":
336
+ return j;
337
+ default:
338
+ return;
339
+ }
340
+ }
341
+ function we(t) {
342
+ let a = se(t);
343
+ for (; a && !(a instanceof e.ZodObject); )
344
+ a = a instanceof e.ZodEffects ? a.innerType() : void 0;
345
+ return a ? Object.keys(a.shape) : void 0;
346
+ }
347
+ function re(t, a) {
348
+ return e.object(t).passthrough().superRefine((o, n) => {
349
+ for (const i of a)
350
+ Object.prototype.hasOwnProperty.call(o, i) || n.addIssue({
351
+ code: "custom",
352
+ path: [i],
353
+ message: `Required field "${i}" is missing.`
354
+ });
355
+ });
356
+ }
357
+ const O = e.object({
358
+ kind: e.literal("semantic"),
359
+ domainId: e.string(),
360
+ datasetName: e.string(),
361
+ datasetId: e.string().optional(),
362
+ label: e.string().optional(),
363
+ connectionId: e.string().optional()
364
+ }).passthrough(), ce = e.object({
365
+ kind: e.literal("physical"),
366
+ connectionId: e.string(),
367
+ connectionType: e.string().optional(),
368
+ tableName: e.string(),
369
+ databaseName: e.string().optional(),
370
+ schemaName: e.string().optional(),
371
+ label: e.string().optional(),
372
+ dialect: g.optional()
373
+ }).passthrough(), le = e.object({
374
+ kind: e.literal("sql"),
375
+ connectionId: e.string(),
376
+ dialect: g.optional(),
377
+ label: e.string().optional()
378
+ }).passthrough(), E = e.union([
379
+ O,
380
+ ce,
381
+ le
382
+ ]), pe = e.object({
383
+ name: e.string(),
384
+ label: e.string().optional(),
385
+ role: h.optional(),
386
+ dataType: y.optional(),
387
+ source: E.optional(),
388
+ aggregate: u.optional()
389
+ }).passthrough(), N = pe, ue = e.object({
390
+ kind: e.literal("field"),
391
+ field: N,
392
+ aggregate: u.optional()
393
+ }).passthrough(), me = e.object({
394
+ kind: e.literal("derived_field"),
395
+ name: e.string(),
396
+ label: e.string(),
397
+ description: e.string().optional(),
398
+ resultRole: h,
399
+ dataType: y,
400
+ computeStage: e.enum(["row", "aggregate"]),
401
+ expression: e.string(),
402
+ expressionLanguage: e.literal("semaphor_sql_template").optional(),
403
+ inputs: e.record(ue),
404
+ defaultAggregate: u.optional(),
405
+ aggregationBehavior: e.enum([
406
+ "additive",
407
+ "non_additive",
408
+ "ratio_of_sums",
409
+ "weighted",
410
+ "pre_aggregated",
411
+ "snapshot"
412
+ ]).optional(),
413
+ aggregationStrategy: e.enum([
414
+ "default",
415
+ "symmetric_aggregate",
416
+ "aggregate_then_join",
417
+ "weighted"
418
+ ]).optional(),
419
+ format: ie.optional(),
420
+ tags: e.array(e.string()).optional()
421
+ }).passthrough(), V = me, Fe = N.and(
422
+ e.object({
423
+ derivedField: V.optional()
424
+ }).passthrough()
425
+ ), de = O, ge = e.object({
426
+ kind: e.literal("physical"),
427
+ connectionId: e.string().optional(),
428
+ connectionType: e.string().optional(),
429
+ tableName: e.string(),
430
+ databaseName: e.string().optional(),
431
+ schemaName: e.string().optional(),
432
+ label: e.string().optional(),
433
+ dialect: g.optional()
434
+ }).passthrough(), he = e.object({
435
+ kind: e.literal("sql"),
436
+ connectionId: e.string().optional(),
437
+ dialect: g.optional(),
438
+ label: e.string().optional()
439
+ }).passthrough(), ye = e.union([
440
+ de,
441
+ ge,
442
+ he
443
+ ]), Ae = e.object({
444
+ key: e.string().optional(),
445
+ name: e.string(),
446
+ label: e.string().optional(),
447
+ role: h.optional(),
448
+ dataType: y.optional(),
449
+ source: ye.optional(),
450
+ aggregate: u.optional(),
451
+ derivedField: e.never().optional()
452
+ }).passthrough(), l = e.object({
453
+ key: e.string(),
454
+ name: e.string(),
455
+ label: e.string(),
456
+ role: h.optional(),
457
+ dataType: y.optional(),
458
+ aggregate: u.optional(),
459
+ source: E.optional(),
460
+ derivedField: V.optional(),
461
+ temporalBucket: k.optional(),
462
+ rawTemporal: oe.optional(),
463
+ pivotIdentity: e.object({
464
+ metricId: e.string().min(1),
465
+ metricAlias: e.string().min(1),
466
+ members: e.array(
467
+ e.object({
468
+ fieldId: e.string().min(1),
469
+ value: e.string().nullable(),
470
+ temporalBucket: k.optional()
471
+ }).strict()
472
+ )
473
+ }).strict().optional()
474
+ }).passthrough().superRefine((t, a) => {
475
+ if (t.temporalBucket && t.rawTemporal && a.addIssue({
476
+ code: e.ZodIssueCode.custom,
477
+ path: ["rawTemporal"],
478
+ message: "A result column cannot carry both temporalBucket and rawTemporal metadata."
479
+ }), t.temporalBucket) {
480
+ const o = B(
481
+ t.temporalBucket.granularity
482
+ );
483
+ t.dataType !== o && a.addIssue({
484
+ code: e.ZodIssueCode.custom,
485
+ path: ["dataType"],
486
+ message: `${t.temporalBucket.granularity} temporal buckets require dataType ${o}.`
487
+ });
488
+ }
489
+ if (t.rawTemporal) {
490
+ const o = t.rawTemporal.valueKind === "date" ? "date" : "datetime";
491
+ t.dataType !== o && a.addIssue({
492
+ code: e.ZodIssueCode.custom,
493
+ path: ["dataType"],
494
+ message: `${t.rawTemporal.valueKind} raw temporal values require dataType ${o}.`
495
+ });
496
+ }
497
+ }), Me = e.object({
498
+ records: p,
499
+ columns: e.array(l).optional()
500
+ }).passthrough(), Ce = e.object({
501
+ records: p,
502
+ columns: e.array(l)
503
+ }).passthrough(), U = e.object({
504
+ code: e.string(),
505
+ message: e.string().optional(),
506
+ invalidField: e.string().optional(),
507
+ fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
508
+ validMeasureCandidates: e.array(e.string()).optional(),
509
+ validDateCandidates: e.array(e.string()).optional(),
510
+ validDimensionCandidates: e.array(e.string()).optional(),
511
+ recommendedNextStep: e.string()
512
+ }).passthrough(), I = e.object({
513
+ code: e.string(),
514
+ message: e.string(),
515
+ path: e.string().optional(),
516
+ fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
517
+ repairHint: U.optional()
518
+ }).passthrough(), Oe = e.object({
519
+ ok: e.boolean(),
520
+ errors: e.array(I),
521
+ warnings: e.array(I),
522
+ repairHints: e.array(U)
523
+ }).passthrough(), fe = e.object({
524
+ page: e.number(),
525
+ pageSize: e.number(),
526
+ pageCount: e.number(),
527
+ totalCount: e.number(),
528
+ hasNextPage: e.boolean(),
529
+ hasPrevPage: e.boolean()
530
+ }).passthrough(), f = {
531
+ intentId: e.string().optional(),
532
+ queryPath: e.enum(["query_spec", "sql", "sql_python"]),
533
+ warnings: e.array(e.string()).optional(),
534
+ rowCount: e.number().optional(),
535
+ rowLimitExceeded: e.boolean().optional(),
536
+ limit: e.number().optional(),
537
+ pagination: fe.optional()
538
+ }, Ee = e.object({
539
+ ...f,
540
+ kind: e.literal("metric"),
541
+ primaryValue: R,
542
+ measures: e.record(R).optional(),
543
+ missingMeasures: e.array(e.string()).optional(),
544
+ comparison: e.object({
545
+ kind: e.enum(["previous_period", "previous_year", "target"]),
546
+ value: R.optional(),
547
+ delta: e.union([e.number(), e.null()]).optional(),
548
+ deltaPercent: e.union([e.number(), e.null()]).optional()
549
+ }).passthrough().optional(),
550
+ records: p.optional()
551
+ }).passthrough(), Ne = e.object({
552
+ ...f,
553
+ kind: e.literal("records"),
554
+ columns: e.array(l),
555
+ records: p,
556
+ totals: e.object({
557
+ mode: e.literal("server"),
558
+ scope: e.literal("filtered_result"),
559
+ row: e.record(e.string(), e.unknown()),
560
+ columns: e.array(l).optional()
561
+ }).passthrough().optional()
562
+ }).passthrough(), be = e.object({
563
+ inputId: e.string().min(1),
564
+ status: e.enum(["applied", "inactive", "skipped", "overridden", "error"]),
565
+ reason: e.enum([
566
+ "unrelated",
567
+ "population_required",
568
+ "missing_dependency",
569
+ "missing_relationship",
570
+ "ambiguous_relationship",
571
+ "invalid_metadata",
572
+ "unsupported_dependency",
573
+ "override_not_eligible"
574
+ ]).optional()
575
+ }), Se = e.object({
576
+ complete: e.boolean(),
577
+ reason: e.enum(["unsupported", "truncated"]).optional()
578
+ }), Ve = e.object({
579
+ ...f,
580
+ kind: e.literal("inputOptions"),
581
+ dependencyOutcomes: e.array(be).optional(),
582
+ match: Se.optional(),
583
+ options: e.array(
584
+ re(
585
+ {
586
+ label: e.string(),
587
+ value: e.unknown(),
588
+ count: e.number().optional(),
589
+ disambiguation: e.array(e.string()).optional()
590
+ },
591
+ ["value"]
592
+ )
593
+ )
594
+ }).passthrough(), Ue = e.object({
595
+ ...f,
596
+ kind: e.literal("sql"),
597
+ columns: e.array(l),
598
+ records: p,
599
+ sqlShape: e.object({
600
+ statementType: e.string().optional(),
601
+ explicitLimit: e.number().optional(),
602
+ hasPythonCode: e.boolean().optional()
603
+ }).passthrough().optional()
604
+ }).passthrough();
605
+ export {
606
+ we as A,
607
+ O as B,
608
+ ce as C,
609
+ le as D,
610
+ pe as E,
611
+ N as F,
612
+ me as G,
613
+ V as H,
614
+ Fe as I,
615
+ Ae as J,
616
+ l as K,
617
+ Me as L,
618
+ Re as M,
619
+ Ce as N,
620
+ P as O,
621
+ I as P,
622
+ Oe as Q,
623
+ ke as R,
624
+ Ie as S,
625
+ xe as T,
626
+ Ee as U,
627
+ Ne as V,
628
+ be as W,
629
+ Se as X,
630
+ Ve as Y,
631
+ Ue as Z,
632
+ B as a,
633
+ k as b,
634
+ ve as c,
635
+ D as d,
636
+ Te as e,
637
+ Z as f,
638
+ p as g,
639
+ u as h,
640
+ G as i,
641
+ Q as j,
642
+ j as k,
643
+ oe as l,
644
+ w as m,
645
+ R as n,
646
+ ne as o,
647
+ F as p,
648
+ A as q,
649
+ J as r,
650
+ E as s,
651
+ Y as t,
652
+ M as u,
653
+ C as v,
654
+ ie as w,
655
+ De as x,
656
+ je as y,
657
+ se as z
658
+ };