react-semaphor 0.1.602 → 0.1.604

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 (211) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1451
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +4 -1594
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
  11. package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
  12. package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
  15. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  16. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  17. package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
  18. package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
  19. package/dist/chunks/brand-DCaZyRt6.js +1 -0
  20. package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
  21. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  22. package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
  23. package/dist/chunks/context-ALdccLHw.js +2 -0
  24. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  25. package/dist/chunks/dashboard-BX28ld6s.js +1 -0
  26. package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
  27. package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
  28. package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
  29. package/dist/chunks/dates-D-KP8G-z.js +1 -0
  30. package/dist/chunks/edit-DEAK0UZo.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-CwQrqORc.js +1 -0
  34. package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
  35. package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
  36. package/dist/chunks/index-B-VF1ogs.js +1 -0
  37. package/dist/chunks/index-BE1DfxNs.js +1 -0
  38. package/dist/chunks/index-DViPGDFj.js +1 -0
  39. package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
  43. package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  45. package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
  46. package/dist/chunks/palette-BzC-CGOc.js +6 -0
  47. package/dist/chunks/pickers-DuBrUht0.js +1 -0
  48. package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
  49. package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
  50. package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
  51. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  52. package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
  53. package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
  54. package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
  55. package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
  56. package/dist/chunks/save-DdFUZcbi.js +6 -0
  57. package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
  58. package/dist/chunks/schema-MC0cQSAb.js +4 -0
  59. package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
  60. package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
  61. package/dist/chunks/set-DuJfGkbY.js +1 -0
  62. package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
  63. package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
  64. package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
  65. package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
  66. package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
  67. package/dist/chunks/validators-CqV3Yka1.js +1 -0
  68. package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
  69. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  70. package/dist/dashboard/index.js +1 -7
  71. package/dist/dashboard-authoring/index.js +1 -4491
  72. package/dist/format-utils/index.js +1 -424
  73. package/dist/index.js +1 -554
  74. package/dist/layouts/index.js +1 -7
  75. package/dist/live-channel/index.js +1 -124
  76. package/dist/pdf-export-policy/index.js +1 -92
  77. package/dist/pdf-table-layout/index.js +1 -993
  78. package/dist/report-runtime-context/index.js +1 -9
  79. package/dist/shared/index.js +1 -6
  80. package/dist/style.css +1 -1
  81. package/dist/surfboard/index.js +1 -9
  82. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  83. package/dist/types/index.js +1 -88
  84. package/dist/types/lib/document/document-edits.d.ts +0 -4
  85. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  86. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  87. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  88. package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
  89. package/dist/types/lib/types/common-types.d.ts +0 -2
  90. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  91. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  92. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  93. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  94. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  95. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  96. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  97. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  98. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  99. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  100. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  101. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  102. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  103. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  104. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
  105. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  106. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  107. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  108. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  109. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  110. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  111. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
  112. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  113. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  114. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  117. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  119. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
  120. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  121. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  122. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  123. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
  124. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  125. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  126. package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
  127. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  128. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  129. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  130. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  131. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  132. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  133. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  134. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  135. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  136. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
  137. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
  138. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  140. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  141. package/dist/types/shared/format-utils/index.d.ts +1 -0
  142. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  143. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  144. package/dist/types/shared/temporal/index.d.ts +2 -0
  145. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  146. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  147. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  148. package/dist/usage-events/index.js +1 -285
  149. package/dist/value-format-preferences/index.js +1 -635
  150. package/package.json +6 -2
  151. package/dist/chunks/add-to-dashboard-ClhEIFst.js +0 -291
  152. package/dist/chunks/analytics-base-schemas-DevrgqQb.js +0 -678
  153. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  154. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  155. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  156. package/dist/chunks/assistant-chat-BWF3GYip.js +0 -6115
  157. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  158. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  159. package/dist/chunks/bookmark-impact-BF3iRx5a.js +0 -76
  160. package/dist/chunks/bookmark-state-CBSTdW6q.js +0 -1666
  161. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  162. package/dist/chunks/card-filter-builder-B8XHwMY6.js +0 -4069
  163. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  164. package/dist/chunks/comparison-window-caption-W83qB4V5.js +0 -741
  165. package/dist/chunks/context-BJoEFgNl.js +0 -369
  166. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  167. package/dist/chunks/dashboard-DG5EIYYB.js +0 -14
  168. package/dist/chunks/dashboard-briefing-launcher-CBSrhyWZ.js +0 -4875
  169. package/dist/chunks/dashboard-controls-D6ECO4N1.js +0 -2290
  170. package/dist/chunks/dashboard-json-DrJftBSL.js +0 -66
  171. package/dist/chunks/dates-Bz-qM5px.js +0 -164
  172. package/dist/chunks/edit-9df1zOWe.js +0 -226
  173. package/dist/chunks/edit-dashboard-visual-BDYAJIbb.js +0 -18605
  174. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  175. package/dist/chunks/filter-line-BXT6y303.js +0 -703
  176. package/dist/chunks/filter-reach-copy-BukhZmzm.js +0 -5250
  177. package/dist/chunks/filter-value-text-D3-bf3_b.js +0 -153
  178. package/dist/chunks/index-BVKzKl5d.js +0 -90
  179. package/dist/chunks/index-BW0yozjs.js +0 -2795
  180. package/dist/chunks/index-CV_Kzou0.js +0 -595
  181. package/dist/chunks/layout-grid-Ds0diMeY.js +0 -16
  182. package/dist/chunks/matrix-analytical-definition-CgQgVeeI.js +0 -1162
  183. package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
  184. package/dist/chunks/matrix-operation-contract--DkNCOzd.js +0 -1412
  185. package/dist/chunks/metric-comparison-zMylnIkc.js +0 -541
  186. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  187. package/dist/chunks/paintbrush-CX8pao1j.js +0 -27
  188. package/dist/chunks/palette-CuA0HlzF.js +0 -23
  189. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  190. package/dist/chunks/pivot-result-contract-expectations-C8KL7hPx.js +0 -5046
  191. package/dist/chunks/pivot-result-identity-C1AOH1PS.js +0 -77
  192. package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
  193. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  194. package/dist/chunks/report-preferences-dialog-CbuVNDGi.js +0 -1637
  195. package/dist/chunks/report-runtime-context-E7USjN7E.js +0 -388
  196. package/dist/chunks/resolve-dashboard-input-context-CULCE_hM.js +0 -25172
  197. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  198. package/dist/chunks/save-BKHlDONy.js +0 -21
  199. package/dist/chunks/saved-dashboard-context-C1WlOx5z.js +0 -632
  200. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  201. package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
  202. package/dist/chunks/semaphor-ready-indicator-CBIRcDWs.js +0 -145326
  203. package/dist/chunks/shelf-drop-preview-context-xR69SMA8.js +0 -2466
  204. package/dist/chunks/stored-dashboard-BuM8vnWf.js +0 -4070
  205. package/dist/chunks/style-sheet-parts-Bt9ZNre8.js +0 -8674
  206. package/dist/chunks/table-export-sheet-DVljtHkG.js +0 -949
  207. package/dist/chunks/token-types-D_xKgyVS.js +0 -8
  208. package/dist/chunks/upload-Dll_M7XQ.js +0 -15
  209. package/dist/chunks/validators-ClWHpYql.js +0 -3686
  210. package/dist/chunks/variable-draft-CDGGl53R.js +0 -242
  211. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -1,678 +0,0 @@
1
- import { z as e } from "zod";
2
- const Z = [
3
- "missing_dependency",
4
- "missing_relationship",
5
- "population_required",
6
- "ambiguous_relationship"
7
- ];
8
- function Re(t) {
9
- return Z.includes(
10
- t
11
- );
12
- }
13
- const Ie = 200, D = [
14
- "second",
15
- "minute",
16
- "hour",
17
- "day",
18
- "week",
19
- "month",
20
- "quarter",
21
- "year"
22
- ];
23
- function xe(t) {
24
- return typeof t == "string" && D.includes(t);
25
- }
26
- const B = [
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
- ], G = ["hour", "day", "week", "month", "quarter", "year"], De = {
39
- invalidMetadata: "invalid_raw_temporal_metadata"
40
- };
41
- function z(t) {
42
- return t === "second" || t === "minute" || t === "hour" ? "datetime" : "date";
43
- }
44
- const je = {
45
- missingMetadata: "missing_temporal_bucket_metadata",
46
- invalidMetadata: "invalid_temporal_bucket_metadata",
47
- invalidValue: "invalid_temporal_bucket_value"
48
- }, we = "__auto_count__";
49
- function j(t) {
50
- try {
51
- return new Intl.DateTimeFormat("en-US", { timeZone: t }).format(), !0;
52
- } catch {
53
- return !1;
54
- }
55
- }
56
- const L = 20;
57
- function d(t) {
58
- if (!(typeof t != "number" || !Number.isFinite(t)))
59
- return Math.max(0, Math.min(L, 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 $(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 H(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 K = /* @__PURE__ */ new Set(["number", "currency", "percent", "percentage", "scientific"]), W = /* @__PURE__ */ new Set(["millisecond", "second", "minute", "hour", "day"]);
84
- function v(t) {
85
- return typeof t == "string" && W.has(t) ? t : void 0;
86
- }
87
- function X(t) {
88
- const a = t.percentValueMode ?? "fraction";
89
- if (t.scale === 1 && a === "whole") {
90
- const { scale: i, ...f } = t;
91
- return { ...f, 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 Y(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 f = t.negativeStyle === "parentheses" || t.negativeStyle === "minus" ? t.negativeStyle : void 0, P = 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" ? $(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: f,
121
- compact: _(t.compact),
122
- scale: H(t.scale),
123
- percentValueMode: a === "percent" ? t.percentValueMode === "whole" ? "whole" : "fraction" : void 0,
124
- signDisplay: P
125
- });
126
- return m.type === "percent" && m.scale !== void 0 ? X(m) : m;
127
- }
128
- function J(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" && K.has(a.type))
136
- return Y(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 Q = e.record(e.string(), e.unknown()), p = e.array(Q), 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
- ]), ee = 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
- ]), T = e.union([e.number(), e.string(), e.null()]), k = e.enum([
201
- "millisecond",
202
- "second",
203
- "minute",
204
- "hour",
205
- "day"
206
- ]), te = e.enum(B), ae = e.discriminatedUnion("mode", [
207
- e.object({ mode: e.literal("auto") }).strict(),
208
- e.object({
209
- mode: e.literal("preset"),
210
- preset: te
211
- }).strict(),
212
- e.object({
213
- mode: e.literal("pattern"),
214
- pattern: e.string().min(1)
215
- }).strict()
216
- ]), w = e.object({
217
- type: e.literal("temporal_bucket"),
218
- presentation: ae
219
- }).strict(), oe = e.object({
220
- tz: e.string().min(1).refine(j, {
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(), R = e.object({
229
- kind: e.literal("temporal_bucket"),
230
- granularity: ee,
231
- calendar: oe
232
- }).strict(), ne = e.object({
233
- grainSource: e.enum(["automatic", "card"]),
234
- window: e.object({ startInclusive: e.string(), endExclusive: e.string() }).strict().optional(),
235
- automaticGrain: e.enum(G),
236
- holdsTime: e.boolean()
237
- }).strict(), ie = e.object({
238
- kind: e.literal("raw_temporal"),
239
- valueKind: e.enum(["date", "wall_datetime", "instant"])
240
- }).strict(), Ae = e.object({
241
- kind: e.literal("raw_temporal"),
242
- valueKind: e.enum(["date", "wall_datetime", "instant"]),
243
- tz: e.string().min(1).refine(j, "tz must be an IANA timezone.")
244
- }).strict(), r = e.string(), I = e.number().int().min(0).max(20), A = e.object({
245
- type: e.enum(["number", "currency", "percent", "scientific"]),
246
- currency: e.string().regex(/^[A-Z]{3}$/, "Expected an ISO 4217 currency code.").optional(),
247
- minimumFractionDigits: I.optional(),
248
- maximumFractionDigits: I.optional(),
249
- useGrouping: e.boolean().optional(),
250
- prefix: r.optional(),
251
- suffix: r.optional(),
252
- negativeStyle: e.enum(["minus", "parentheses"]).optional(),
253
- compact: e.boolean().optional(),
254
- scale: e.number().finite().optional(),
255
- percentValueMode: e.enum(["fraction", "whole"]).optional(),
256
- signDisplay: e.enum(["auto", "always", "exceptZero", "never"]).optional()
257
- }).strict().superRefine((t, a) => {
258
- const { minimumFractionDigits: o, maximumFractionDigits: n } = t;
259
- o !== void 0 && n !== void 0 && o > n && a.addIssue({
260
- code: e.ZodIssueCode.custom,
261
- path: ["minimumFractionDigits"],
262
- message: "minimumFractionDigits must not exceed maximumFractionDigits."
263
- }), t.currency !== void 0 && t.type !== "currency" && a.addIssue({
264
- code: e.ZodIssueCode.custom,
265
- path: ["currency"],
266
- message: "Only a currency format names a currency."
267
- }), t.type === "percent" ? (t.percentValueMode === void 0 && a.addIssue({
268
- code: e.ZodIssueCode.custom,
269
- path: ["percentValueMode"],
270
- message: "A percent format states percentValueMode: fraction (0.25 is 25%) or whole (25 is 25%)."
271
- }), t.scale !== void 0 && a.addIssue({
272
- code: e.ZodIssueCode.custom,
273
- path: ["scale"],
274
- message: "A percent format has no scale; percentValueMode says how the value is read."
275
- })) : t.percentValueMode !== void 0 && a.addIssue({
276
- code: e.ZodIssueCode.custom,
277
- path: ["percentValueMode"],
278
- message: "Only a percent format has percentValueMode."
279
- });
280
- }), se = ["short", "long", "numeric", "iso"], F = e.object({
281
- type: e.literal("date"),
282
- pattern: e.string().min(1).optional(),
283
- dialect: e.enum(["semaphor_tokens", "date_fns"]).optional(),
284
- preset: e.enum(se).optional(),
285
- relative: e.boolean().optional(),
286
- timezone: e.string().min(1).optional(),
287
- sourceTimezone: e.string().min(1).optional(),
288
- prefix: r.optional(),
289
- suffix: r.optional()
290
- }).strict().superRefine((t, a) => {
291
- t.pattern !== void 0 && t.preset !== void 0 && a.addIssue({
292
- code: e.ZodIssueCode.custom,
293
- path: ["preset"],
294
- message: "A date format has a pattern or a preset, not both."
295
- }), t.dialect !== void 0 && t.pattern === void 0 && a.addIssue({
296
- code: e.ZodIssueCode.custom,
297
- path: ["dialect"],
298
- message: "dialect names the token set of a pattern."
299
- });
300
- }), C = e.object({
301
- type: e.literal("duration"),
302
- inputUnit: k.optional(),
303
- outputStyle: e.enum(["compact", "digital", "long"]).optional(),
304
- largestUnit: k.optional(),
305
- smallestUnit: k.optional(),
306
- maxUnits: e.number().int().min(0).max(10).optional(),
307
- prefix: r.optional(),
308
- suffix: r.optional(),
309
- negativeStyle: e.enum(["minus", "parentheses"]).optional()
310
- }).strict(), M = e.object({
311
- type: e.literal("string"),
312
- prefix: r.optional(),
313
- suffix: r.optional()
314
- }).strict(), O = e.union([
315
- A,
316
- F,
317
- C,
318
- M
319
- ]), re = e.unknown().superRefine((t, a) => {
320
- t && typeof t == "object" && "locale" in t && ["number", "currency", "percent", "percentage", "scientific"].includes(
321
- String(t.type)
322
- ) && a.addIssue({
323
- code: e.ZodIssueCode.custom,
324
- path: ["locale"],
325
- message: "Numeric semantic formats inherit locale from viewer preferences."
326
- });
327
- }).transform((t) => J(t) ?? t).pipe(O), Fe = e.union([
328
- O,
329
- w
330
- ]), Ce = ["number", "currency", "percent", "scientific", "duration", "date", "string", "temporal_bucket"];
331
- function ce(t) {
332
- switch (t) {
333
- case "number":
334
- case "currency":
335
- case "percent":
336
- case "scientific":
337
- return A;
338
- case "date":
339
- return F;
340
- case "duration":
341
- return C;
342
- case "string":
343
- return M;
344
- case "temporal_bucket":
345
- return w;
346
- default:
347
- return;
348
- }
349
- }
350
- function Me(t) {
351
- let a = ce(t);
352
- for (; a && !(a instanceof e.ZodObject); )
353
- a = a instanceof e.ZodEffects ? a.innerType() : void 0;
354
- return a ? Object.keys(a.shape) : void 0;
355
- }
356
- function le(t, a) {
357
- return e.object(t).passthrough().superRefine((o, n) => {
358
- for (const i of a)
359
- Object.prototype.hasOwnProperty.call(o, i) || n.addIssue({
360
- code: "custom",
361
- path: [i],
362
- message: `Required field "${i}" is missing.`
363
- });
364
- });
365
- }
366
- const E = e.object({
367
- kind: e.literal("semantic"),
368
- domainId: e.string(),
369
- datasetName: e.string(),
370
- datasetId: e.string().optional(),
371
- label: e.string().optional(),
372
- connectionId: e.string().optional()
373
- }).passthrough(), pe = e.object({
374
- kind: e.literal("physical"),
375
- connectionId: e.string(),
376
- connectionType: e.string().optional(),
377
- tableName: e.string(),
378
- databaseName: e.string().optional(),
379
- schemaName: e.string().optional(),
380
- label: e.string().optional(),
381
- dialect: g.optional()
382
- }).passthrough(), ue = e.object({
383
- kind: e.literal("sql"),
384
- connectionId: e.string(),
385
- dialect: g.optional(),
386
- label: e.string().optional()
387
- }).passthrough(), N = e.union([
388
- E,
389
- pe,
390
- ue
391
- ]), me = e.object({
392
- name: e.string(),
393
- label: e.string().optional(),
394
- role: h.optional(),
395
- dataType: y.optional(),
396
- source: N.optional(),
397
- aggregate: u.optional()
398
- }).passthrough(), V = me, de = e.object({
399
- kind: e.literal("field"),
400
- field: V,
401
- aggregate: u.optional()
402
- }).passthrough(), ge = e.object({
403
- kind: e.literal("derived_field"),
404
- name: e.string(),
405
- label: e.string(),
406
- description: e.string().optional(),
407
- resultRole: h,
408
- dataType: y,
409
- computeStage: e.enum(["row", "aggregate"]),
410
- expression: e.string(),
411
- expressionLanguage: e.literal("semaphor_sql_template").optional(),
412
- inputs: e.record(de),
413
- defaultAggregate: u.optional(),
414
- aggregationBehavior: e.enum([
415
- "additive",
416
- "non_additive",
417
- "ratio_of_sums",
418
- "weighted",
419
- "pre_aggregated",
420
- "snapshot"
421
- ]).optional(),
422
- aggregationStrategy: e.enum([
423
- "default",
424
- "symmetric_aggregate",
425
- "aggregate_then_join",
426
- "weighted"
427
- ]).optional(),
428
- format: re.optional(),
429
- tags: e.array(e.string()).optional()
430
- }).passthrough(), U = ge, Oe = V.and(
431
- e.object({
432
- derivedField: U.optional()
433
- }).passthrough()
434
- ), he = E, ye = e.object({
435
- kind: e.literal("physical"),
436
- connectionId: e.string().optional(),
437
- connectionType: e.string().optional(),
438
- tableName: e.string(),
439
- databaseName: e.string().optional(),
440
- schemaName: e.string().optional(),
441
- label: e.string().optional(),
442
- dialect: g.optional()
443
- }).passthrough(), be = e.object({
444
- kind: e.literal("sql"),
445
- connectionId: e.string().optional(),
446
- dialect: g.optional(),
447
- label: e.string().optional()
448
- }).passthrough(), fe = e.union([
449
- he,
450
- ye,
451
- be
452
- ]), Ee = e.object({
453
- key: e.string().optional(),
454
- name: e.string(),
455
- label: e.string().optional(),
456
- role: h.optional(),
457
- dataType: y.optional(),
458
- source: fe.optional(),
459
- aggregate: u.optional(),
460
- derivedField: e.never().optional()
461
- }).passthrough(), l = e.object({
462
- key: e.string(),
463
- name: e.string(),
464
- label: e.string(),
465
- role: h.optional(),
466
- dataType: y.optional(),
467
- aggregate: u.optional(),
468
- source: N.optional(),
469
- derivedField: U.optional(),
470
- temporalBucket: R.optional(),
471
- rawTemporal: ie.optional(),
472
- dateGrain: ne.optional(),
473
- pivotIdentity: e.object({
474
- metricId: e.string().min(1),
475
- metricAlias: e.string().min(1),
476
- members: e.array(
477
- e.object({
478
- fieldId: e.string().min(1),
479
- value: e.string().nullable(),
480
- temporalBucket: R.optional()
481
- }).strict()
482
- )
483
- }).strict().optional()
484
- }).passthrough().superRefine((t, a) => {
485
- if (t.temporalBucket && t.rawTemporal && a.addIssue({
486
- code: e.ZodIssueCode.custom,
487
- path: ["rawTemporal"],
488
- message: "A result column cannot carry both temporalBucket and rawTemporal metadata."
489
- }), t.temporalBucket) {
490
- const o = z(
491
- t.temporalBucket.granularity
492
- );
493
- t.dataType !== o && a.addIssue({
494
- code: e.ZodIssueCode.custom,
495
- path: ["dataType"],
496
- message: `${t.temporalBucket.granularity} temporal buckets require dataType ${o}.`
497
- });
498
- }
499
- if (t.rawTemporal) {
500
- const o = t.rawTemporal.valueKind === "date" ? "date" : "datetime";
501
- t.dataType !== o && a.addIssue({
502
- code: e.ZodIssueCode.custom,
503
- path: ["dataType"],
504
- message: `${t.rawTemporal.valueKind} raw temporal values require dataType ${o}.`
505
- });
506
- }
507
- }), Ne = e.object({
508
- records: p,
509
- columns: e.array(l).optional()
510
- }).passthrough(), Ve = e.object({
511
- records: p,
512
- columns: e.array(l)
513
- }).passthrough(), q = e.object({
514
- code: e.string(),
515
- message: e.string().optional(),
516
- invalidField: e.string().optional(),
517
- fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
518
- validMeasureCandidates: e.array(e.string()).optional(),
519
- validDateCandidates: e.array(e.string()).optional(),
520
- validDimensionCandidates: e.array(e.string()).optional(),
521
- recommendedNextStep: e.string()
522
- }).passthrough(), x = e.object({
523
- code: e.string(),
524
- message: e.string(),
525
- path: e.string().optional(),
526
- fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
527
- repairHint: q.optional()
528
- }).passthrough(), Ue = e.object({
529
- ok: e.boolean(),
530
- errors: e.array(x),
531
- warnings: e.array(x),
532
- repairHints: e.array(q)
533
- }).passthrough(), Se = e.object({
534
- page: e.number(),
535
- pageSize: e.number(),
536
- pageCount: e.number(),
537
- totalCount: e.number(),
538
- hasNextPage: e.boolean(),
539
- hasPrevPage: e.boolean()
540
- }).passthrough(), b = {
541
- intentId: e.string().optional(),
542
- queryPath: e.enum(["query_spec", "sql", "sql_python"]),
543
- warnings: e.array(e.string()).optional(),
544
- rowCount: e.number().optional(),
545
- rowLimitExceeded: e.boolean().optional(),
546
- limit: e.number().optional(),
547
- pagination: Se.optional()
548
- }, qe = e.object({
549
- ...b,
550
- kind: e.literal("metric"),
551
- primaryValue: T,
552
- measures: e.record(T).optional(),
553
- missingMeasures: e.array(e.string()).optional(),
554
- comparison: e.object({
555
- kind: e.enum(["previous_period", "previous_year", "target"]),
556
- value: T.optional(),
557
- delta: e.union([e.number(), e.null()]).optional(),
558
- deltaPercent: e.union([e.number(), e.null()]).optional()
559
- }).passthrough().optional(),
560
- records: p.optional()
561
- }).passthrough(), Pe = e.object({
562
- ...b,
563
- kind: e.literal("records"),
564
- columns: e.array(l),
565
- records: p,
566
- totals: e.object({
567
- mode: e.literal("server"),
568
- scope: e.literal("filtered_result"),
569
- row: e.record(e.string(), e.unknown()),
570
- columns: e.array(l).optional()
571
- }).passthrough().optional()
572
- }).passthrough(), _e = e.object({
573
- inputId: e.string().min(1),
574
- status: e.enum(["applied", "inactive", "skipped", "overridden", "error"]),
575
- reason: e.enum([
576
- "unrelated",
577
- "population_required",
578
- "missing_dependency",
579
- "missing_relationship",
580
- "ambiguous_relationship",
581
- "invalid_metadata",
582
- "unsupported_dependency",
583
- "override_not_eligible"
584
- ]).optional()
585
- }), ve = e.object({
586
- complete: e.boolean(),
587
- reason: e.enum(["unsupported", "truncated"]).optional()
588
- }), Te = e.object({
589
- kind: e.literal("standardCursor"),
590
- pageSize: e.number().int().positive(),
591
- hasMore: e.boolean(),
592
- nextCursor: e.string().min(1).optional()
593
- }), Ze = e.object({
594
- ...b,
595
- kind: e.literal("inputOptions"),
596
- dependencyOutcomes: e.array(_e).optional(),
597
- match: ve.optional(),
598
- page: Te.optional(),
599
- options: e.array(
600
- le(
601
- {
602
- label: e.string(),
603
- value: e.unknown(),
604
- count: e.number().optional(),
605
- disambiguation: e.array(e.string()).optional()
606
- },
607
- ["value"]
608
- )
609
- )
610
- }).passthrough(), Be = e.object({
611
- ...b,
612
- kind: e.literal("sql"),
613
- columns: e.array(l),
614
- records: p,
615
- sqlShape: e.object({
616
- statementType: e.string().optional(),
617
- explicitLimit: e.number().optional(),
618
- hasPythonCode: e.boolean().optional()
619
- }).passthrough().optional()
620
- }).passthrough();
621
- export {
622
- Te as $,
623
- G as A,
624
- Ce as B,
625
- ce as C,
626
- Me as D,
627
- E,
628
- pe as F,
629
- ue as G,
630
- me as H,
631
- V as I,
632
- ge as J,
633
- U as K,
634
- Oe as L,
635
- Ie as M,
636
- Ee as N,
637
- Z as O,
638
- l as P,
639
- Ne as Q,
640
- De as R,
641
- we as S,
642
- je as T,
643
- Ve as U,
644
- x as V,
645
- Ue as W,
646
- qe as X,
647
- Pe as Y,
648
- _e as Z,
649
- ve as _,
650
- z as a,
651
- Ze as a0,
652
- Be as a1,
653
- R as b,
654
- Re as c,
655
- D as d,
656
- xe as e,
657
- B as f,
658
- p as g,
659
- u as h,
660
- j as i,
661
- ee as j,
662
- w as k,
663
- ne as l,
664
- ie as m,
665
- T as n,
666
- Ae as o,
667
- A as p,
668
- se as q,
669
- Q as r,
670
- N as s,
671
- J as t,
672
- F as u,
673
- C as v,
674
- M as w,
675
- O as x,
676
- re as y,
677
- Fe as z
678
- };