react-semaphor 0.1.568 → 0.1.570

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 (191) hide show
  1. package/README.md +0 -7
  2. package/dist/analytics-protocol/index.js +434 -454
  3. package/dist/appearance/index.js +6 -3
  4. package/dist/appearance-runtime/index.js +1 -1
  5. package/dist/assistant-context/index.js +1 -1
  6. package/dist/brand-studio/index.js +572 -436
  7. package/dist/briefings/index.js +4 -4
  8. package/dist/chunks/appearance-context-BwBp25ZG.js +162 -0
  9. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +80 -0
  10. package/dist/chunks/assistant-chat-B-Ddyy8b.js +5940 -0
  11. package/dist/chunks/{bookmark-impact-CJ-65omV.js → bookmark-impact-DCYD-6Fr.js} +2 -2
  12. package/dist/chunks/{bookmark-state-Du3s13_V.js → bookmark-state-CflS88gq.js} +251 -250
  13. package/dist/chunks/brand-B4BdpAB_.js +54 -0
  14. package/dist/chunks/{card-filter-builder-BBuB99GZ.js → card-filter-builder-0VvKmRst.js} +992 -991
  15. package/dist/chunks/{comparison-window-caption-CMLb3mut.js → comparison-window-caption-PtcDWvkN.js} +252 -253
  16. package/dist/chunks/{dashboard-YnWZC4dK.js → dashboard-DxGIr1vZ.js} +1 -1
  17. package/dist/chunks/{dashboard-briefing-launcher-BF89TU2h.js → dashboard-briefing-launcher-B-quOOOQ.js} +253 -253
  18. package/dist/chunks/{dashboard-controls-atHc1EjP.js → dashboard-controls-Caodx80b.js} +288 -285
  19. package/dist/chunks/dashboard-json-Ct-AGDHF.js +66 -0
  20. package/dist/chunks/{dates-CKO05ino.js → dates-B9mL8BHE.js} +16 -15
  21. package/dist/chunks/edit-Bpdh_P_a.js +226 -0
  22. package/dist/chunks/{edit-dashboard-visual-DdmTfn-J.js → edit-dashboard-visual-DeDTuYB5.js} +2257 -2270
  23. package/dist/chunks/{filter-reach-copy-jZGzK_IH.js → filter-reach-copy-BSY33ro5.js} +1440 -1301
  24. package/dist/chunks/filter-value-text-DvvSNlho.js +146 -0
  25. package/dist/chunks/index-BVKzKl5d.js +90 -0
  26. package/dist/chunks/{index-RNaTnE3m.js → index-CV_Kzou0.js} +233 -223
  27. package/dist/chunks/{index-CPNZW0mu.js → index-y3HUzRNk.js} +76 -77
  28. package/dist/chunks/{layout-grid-0hIlqEtk.js → layout-grid-8rR-LPTk.js} +1 -1
  29. package/dist/chunks/{list-filter-DkgoCeBm.js → list-filter-C1-uTgjR.js} +1 -1
  30. package/dist/chunks/matrix-analytical-definition-dkS8szLM.js +1253 -0
  31. package/dist/chunks/matrix-member-presentation-DRa-9e6Q.js +169 -0
  32. package/dist/chunks/{matrix-operation-contract-Eb6elidS.js → matrix-operation-contract-DCVinw1o.js} +122 -122
  33. package/dist/chunks/{metric-comparison-ChXUFaZu.js → metric-comparison-n9NsIa-2.js} +175 -128
  34. package/dist/chunks/paintbrush-aR17Z3C9.js +27 -0
  35. package/dist/chunks/{palette-4vf2BEEg.js → palette-a5FCZKFI.js} +1 -1
  36. package/dist/chunks/{_commonjsHelpers-DimLPMtv.js → pickers-DkqmtnTL.js} +352 -290
  37. package/dist/chunks/pivot-result-contract-expectations-C-HnUKYe.js +55 -0
  38. package/dist/chunks/{pivot-result-identity-BlbLrqaC.js → pivot-result-identity-B89X5xjb.js} +1 -1
  39. package/dist/chunks/raw-temporal-value-DdT0s47W.js +159 -0
  40. package/dist/chunks/{report-preferences-dialog-Mbd-I0wV.js → report-preferences-dialog-Yvhv3WX2.js} +95 -97
  41. package/dist/chunks/{report-runtime-context-DnA_PiKo.js → report-runtime-context-BhPzLTbS.js} +1 -1
  42. package/dist/chunks/{resolve-dashboard-input-context-Du0fjN3h.js → resolve-dashboard-input-context-Lkbwycwe.js} +5491 -5683
  43. package/dist/chunks/resolver-DG_tfEpt.js +156 -0
  44. package/dist/chunks/{save-D6pHmSSP.js → save-D985VvYp.js} +1 -1
  45. package/dist/chunks/{saved-dashboard-context-y8N6RvjS.js → saved-dashboard-context-DC_TEd6y.js} +6 -6
  46. package/dist/chunks/schema-C9NPiIru.js +2568 -0
  47. package/dist/chunks/{semaphor-ready-indicator-BSEdUq40.js → semaphor-ready-indicator-ByFvqHEO.js} +35916 -36001
  48. package/dist/chunks/{shelf-drop-preview-context-D7QqPl36.js → shelf-drop-preview-context-CjoVaK6J.js} +64 -66
  49. package/dist/chunks/{stored-dashboard-d3xQYxBD.js → stored-dashboard-C0hekXiI.js} +332 -333
  50. package/dist/chunks/{code-editor-DJNOsgJH.js → style-sheet-parts-C7qGZuH1.js} +2402 -2040
  51. package/dist/chunks/{table-export-sheet--DUKWk6o.js → table-export-sheet-CP8zSOhj.js} +1 -1
  52. package/dist/chunks/{temporal-input-presentation--2r9BLr0.js → temporal-input-presentation-CqbJjIuu.js} +18 -18
  53. package/dist/chunks/{token-types-C8JymO8s.js → token-types-iKMplaBL.js} +1 -1
  54. package/dist/chunks/{upload-Cf3wXZT8.js → upload-CiGNKJ_0.js} +1 -1
  55. package/dist/chunks/validators-B8fpdinG.js +3651 -0
  56. package/dist/chunks/{variable-draft-DOX03R4A.js → variable-draft-9-huI1h4.js} +4 -4
  57. package/dist/dashboard/index.js +2 -2
  58. package/dist/dashboard-authoring/index.js +1888 -1826
  59. package/dist/format-utils/index.js +230 -231
  60. package/dist/index.js +349 -353
  61. package/dist/layouts/index.js +1 -1
  62. package/dist/report-runtime-context/index.js +1 -1
  63. package/dist/style.css +1 -1
  64. package/dist/surfboard/index.js +2 -2
  65. package/dist/types/appearance/index.d.ts +1 -0
  66. package/dist/types/brand-studio/brand-studio-draft.d.ts +7 -0
  67. package/dist/types/brand-studio/index.d.ts +1 -1
  68. package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
  69. package/dist/types/components/providers/appearance-runtime-provider.d.ts +4 -1
  70. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -2
  71. package/dist/types/components/sharing-and-management/utils/types.d.ts +0 -72
  72. package/dist/types/components/surfboard/filter/types.d.ts +5 -4
  73. package/dist/types/components/ui-custom/date-range-presets.d.ts +1 -17
  74. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +0 -1
  75. package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -9
  76. package/dist/types/components/visual/data-table/utils/pagination-utils.d.ts +0 -19
  77. package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -1
  78. package/dist/types/index.js +9 -9
  79. package/dist/types/lib/appearance/aliases.d.ts +42 -0
  80. package/dist/types/lib/appearance/compiler.d.ts +6 -0
  81. package/dist/types/lib/appearance/defaults.d.ts +6 -0
  82. package/dist/types/lib/appearance/index.d.ts +2 -0
  83. package/dist/types/lib/appearance/normalize-organization.d.ts +17 -0
  84. package/dist/types/lib/appearance/resolver.d.ts +2 -2
  85. package/dist/types/lib/appearance/types.d.ts +38 -1
  86. package/dist/types/lib/charts/types.d.ts +6 -2
  87. package/dist/types/lib/dashboard/semantic-dataset-references.d.ts +0 -1
  88. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +0 -2
  89. package/dist/types/lib/dashboard-variables/types.d.ts +1 -6
  90. package/dist/types/lib/download-pdf.d.ts +0 -1
  91. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -4
  92. package/dist/types/lib/hooks/use-date-filter.d.ts +3 -3
  93. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  94. package/dist/types/lib/stores/dashboard-store.d.ts +15 -6
  95. package/dist/types/lib/stores/editor-store.d.ts +0 -1
  96. package/dist/types/lib/stores/table-actions.d.ts +0 -1
  97. package/dist/types/lib/table-formatting/table-formatting-css.d.ts +0 -5
  98. package/dist/types/lib/types/common-types.d.ts +3 -2
  99. package/dist/types/lib/types/explorer-types.d.ts +2 -2
  100. package/dist/types/lib/types/index.d.ts +1 -1
  101. package/dist/types/lib/types/summary-types.d.ts +0 -5
  102. package/dist/types/lib/utils/card-definition.d.ts +7 -7
  103. package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +84 -0
  104. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +4 -4
  105. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +2 -2
  106. package/dist/types/shared/analytics-protocol/contracts.d.ts +8 -17
  107. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +10 -10
  108. package/dist/types/shared/analytics-protocol/fixtures.d.ts +3 -2
  109. package/dist/types/shared/analytics-protocol/index.d.ts +2 -4
  110. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +72 -72
  111. package/dist/types/shared/analytics-protocol/relative-date/describe.d.ts +18 -0
  112. package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +7 -0
  113. package/dist/types/shared/analytics-protocol/relative-date/limits.d.ts +3 -0
  114. package/dist/types/shared/analytics-protocol/relative-date/presets.d.ts +11 -0
  115. package/dist/types/shared/analytics-protocol/relative-date/resolve.d.ts +49 -0
  116. package/dist/types/shared/analytics-protocol/relative-date/schemas.d.ts +76 -0
  117. package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +51 -0
  118. package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +111 -0
  119. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +1 -1
  120. package/dist/types/shared/assistant-protocol/context.d.ts +30 -30
  121. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +0 -2
  122. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +344 -1772
  123. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +4 -1
  124. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -4
  125. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +9 -0
  126. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +104 -104
  127. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +20 -20
  128. package/dist/types/shared/dashboard-authoring/dashboard-style/bounds.d.ts +17 -0
  129. package/dist/types/shared/dashboard-authoring/dashboard-style/brand.d.ts +20 -0
  130. package/dist/types/shared/dashboard-authoring/dashboard-style/edit-words.d.ts +7 -0
  131. package/dist/types/shared/dashboard-authoring/dashboard-style/edit.d.ts +19 -0
  132. package/dist/types/shared/dashboard-authoring/dashboard-style/index.d.ts +15 -0
  133. package/dist/types/shared/dashboard-authoring/dashboard-style/layers.d.ts +19 -0
  134. package/dist/types/shared/dashboard-authoring/dashboard-style/legacy.d.ts +21 -0
  135. package/dist/types/shared/dashboard-authoring/dashboard-style/parse.d.ts +18 -0
  136. package/dist/types/shared/dashboard-authoring/dashboard-style/pickers.d.ts +12 -0
  137. package/dist/types/shared/dashboard-authoring/dashboard-style/types.d.ts +122 -0
  138. package/dist/types/shared/dashboard-authoring/dashboard-style/view.d.ts +10 -0
  139. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  140. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +11 -0
  141. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +23 -0
  142. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +10 -2
  143. package/dist/types/shared/format-utils/filter-detail.d.ts +2 -8
  144. package/dist/types/shared/format-utils/filter-line.d.ts +2 -2
  145. package/dist/types/shared/format-utils/matrix-continuation.d.ts +10 -10
  146. package/dist/types/shared/temporal/index.d.ts +0 -2
  147. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +2 -2
  148. package/package.json +7 -26
  149. package/DATA_APP_SDK.md +0 -339
  150. package/dist/chunks/appearance-context-DEYtWinQ.js +0 -126
  151. package/dist/chunks/appearance-runtime-provider-B-M8gwlZ.js +0 -81
  152. package/dist/chunks/assistant-chat-BN5I8KuN.js +0 -8849
  153. package/dist/chunks/color-CJvdlFM_.js +0 -2162
  154. package/dist/chunks/dashboard-json-Cxp3inxd.js +0 -68
  155. package/dist/chunks/filter-value-text-7zhmth1S.js +0 -163
  156. package/dist/chunks/index-CLIro-EG.js +0 -425
  157. package/dist/chunks/index-CuHybtft.js +0 -51
  158. package/dist/chunks/matrix-analytical-definition-C9xB_T84.js +0 -717
  159. package/dist/chunks/matrix-card-BSUeSXpD.js +0 -42
  160. package/dist/chunks/matrix-member-presentation-DZNgQpUq.js +0 -105
  161. package/dist/chunks/operators-B3zZoskU.js +0 -66
  162. package/dist/chunks/pivot-result-contract-expectations-Ddh1rNz5.js +0 -56
  163. package/dist/chunks/raw-temporal-value-Bqz8wc7L.js +0 -242
  164. package/dist/chunks/selection-reducer-OaJ-N5uN.js +0 -46
  165. package/dist/chunks/source-entity-resolution-DF6GulDn.js +0 -607
  166. package/dist/chunks/validators-wtjw0aw6.js +0 -3332
  167. package/dist/data-app-sdk/index.js +0 -1412
  168. package/dist/data-app-sdk-adapters/index.js +0 -361
  169. package/dist/data-app-sdk-validation/index.js +0 -1031
  170. package/dist/types/components/sharing-and-management/utils/group-types.d.ts +0 -105
  171. package/dist/types/data-app-sdk/adapters.d.ts +0 -35
  172. package/dist/types/data-app-sdk/builders.d.ts +0 -62
  173. package/dist/types/data-app-sdk/contracts.d.ts +0 -419
  174. package/dist/types/data-app-sdk/executor.d.ts +0 -5
  175. package/dist/types/data-app-sdk/field-catalog-validation.d.ts +0 -29
  176. package/dist/types/data-app-sdk/hooks.d.ts +0 -11
  177. package/dist/types/data-app-sdk/index.d.ts +0 -9
  178. package/dist/types/data-app-sdk/provider.d.ts +0 -8
  179. package/dist/types/data-app-sdk/relationship-aware-field-policy.d.ts +0 -21
  180. package/dist/types/data-app-sdk/selection.d.ts +0 -2
  181. package/dist/types/data-app-sdk/validation.d.ts +0 -58
  182. package/dist/types/data-app-sdk-adapters.d.ts +0 -2
  183. package/dist/types/data-app-sdk-validation.d.ts +0 -2
  184. package/dist/types/data-app-sdk.d.ts +0 -2
  185. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +0 -68
  186. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +0 -20
  187. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +0 -314
  188. package/dist/types/shared/analytics-protocol/time-window.d.ts +0 -52
  189. package/dist/types/shared/temporal/relative-date.d.ts +0 -21
  190. package/dist/types/shared/temporal/time-window-periods.d.ts +0 -21
  191. package/src/data-app-sdk/README.md +0 -402
@@ -1,717 +0,0 @@
1
- import { r as G } from "./metric-comparison-ChXUFaZu.js";
2
- import { H as E, aJ as Y, aI as V, aK as J, aH as X, aG as ee, ad as $, a0 as j, N as te } from "./validators-wtjw0aw6.js";
3
- import { h as ne, w as h, e as F } from "./raw-temporal-value-Bqz8wc7L.js";
4
- import { z as u } from "zod";
5
- import { d as ie } from "./analytics-base-schemas-BaIQrEzX.js";
6
- function ae(e, t) {
7
- return G({ ...e, role: t });
8
- }
9
- function Oe(e, t) {
10
- if (t.id) {
11
- const n = [];
12
- e.forEach(
13
- ({ fields: a }, s) => a.forEach((r, o) => {
14
- r.id === t.id && n.push({ group: s, index: o });
15
- })
16
- );
17
- const i = t.alias ? n.find(
18
- ({ group: a, index: s }) => ae(e[a].fields[s], e[a].role) === t.alias
19
- ) : void 0;
20
- if (i) return i;
21
- if (n.length === 1) return n[0];
22
- }
23
- for (let n = 0; n < e.length; n += 1) {
24
- const i = e[n].fields.findIndex(
25
- (a) => a.name === t.name && a.entityName === t.entityName && (a.alias === t.alias || !t.alias)
26
- );
27
- if (i !== -1) return { group: n, index: i };
28
- }
29
- }
30
- function U(e, t) {
31
- const n = e.split(".").map((o) => o.trim()), i = t.split(".").map((o) => o.trim());
32
- if (n.length === 0 || i.length === 0 || n.some((o) => !o) || i.some((o) => !o))
33
- return !1;
34
- const [a, s] = n.length <= i.length ? [n, i] : [i, n], r = s.length - a.length;
35
- return a.every((o, c) => o === s[c + r]);
36
- }
37
- function se(e, t) {
38
- const n = e.split("."), i = t.split("."), a = n.pop(), s = i.pop();
39
- return !!(a && a === s && n.length > 0 && i.length > 0 && U(
40
- n.join("."),
41
- i.join(".")
42
- ));
43
- }
44
- function re(e) {
45
- const t = e.map((i) => i.trim()).filter(Boolean);
46
- if (t.every(
47
- (i, a) => t.slice(a + 1).every(
48
- (s) => U(i, s)
49
- )
50
- ))
51
- return [...t].sort(
52
- (i, a) => a.split(".").length - i.split(".").length
53
- )[0];
54
- }
55
- function y(e) {
56
- return typeof e == "object" && e !== null && !Array.isArray(e);
57
- }
58
- function P(e) {
59
- if (typeof e != "string") return "";
60
- const t = e.split(".").map((n) => n.trim());
61
- return t.length > 1 && t.every(Boolean) ? t.join(".") : "";
62
- }
63
- function N(e) {
64
- if (typeof e != "string") return "";
65
- const t = e.split(".").map((n) => n.trim());
66
- return t.length > 0 && t.every(Boolean) ? t.join(".") : "";
67
- }
68
- function g(e) {
69
- return typeof e == "string" ? e.trim() : "";
70
- }
71
- function oe(e, t) {
72
- return e.every(
73
- (n, i) => e.slice(i + 1).every((a) => t(n, a))
74
- );
75
- }
76
- function de(e, t) {
77
- const n = g(e.id), i = g(e.name), a = g(t.entityId), s = g(t.entityName);
78
- return !i || !a && !s ? !1 : (!a || a === n || a === i) && (!s || s === i);
79
- }
80
- function ue(e) {
81
- const t = y(e.semanticContext) ? e.semanticContext : void 0, n = y(e.fieldMeta) ? e.fieldMeta : void 0, i = g(t == null ? void 0 : t.semanticDomainId), a = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(
82
- (I) => y(I) && I.type === "dataset"
83
- ) : [];
84
- if (!!!(i || a.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
85
- if (!i)
86
- return { status: "unresolved", reason: "incomplete_source_identity" };
87
- const r = g(n == null ? void 0 : n.entityId), o = g(n == null ? void 0 : n.entityName), c = !!(r || o), m = c ? a.filter(
88
- (I) => de(I, {
89
- entityId: r,
90
- entityName: o
91
- })
92
- ) : a;
93
- if (m.length > 1)
94
- return { status: "unresolved", reason: "incomplete_source_identity" };
95
- if (c && a.length > 0 && m.length === 0)
96
- return { status: "unresolved", reason: "divergent_source_identity" };
97
- const l = m[0], d = g(l == null ? void 0 : l.domainId), f = g(l == null ? void 0 : l.id), p = g(l == null ? void 0 : l.name);
98
- if (d && d !== i)
99
- return { status: "unresolved", reason: "divergent_source_identity" };
100
- const v = f, W = p || o;
101
- return W ? {
102
- status: "resolved",
103
- source: {
104
- kind: "semantic",
105
- domainId: i,
106
- datasetName: W,
107
- ...v ? { datasetId: v } : {}
108
- }
109
- } : { status: "unresolved", reason: "incomplete_source_identity" };
110
- }
111
- function ce(e, t) {
112
- const n = g(e.connectionId), i = y(e.semanticContext) ? e.semanticContext : void 0, a = g(i == null ? void 0 : i.connectionId);
113
- if (n && a && n !== a)
114
- return { status: "unresolved", reason: "divergent_source_identity" };
115
- const s = n || a, r = y(e.fieldMeta) ? e.fieldMeta : void 0, o = t.split(".").slice(0, -1).join("."), c = N(e.qualifiedTableName), m = N(
116
- r == null ? void 0 : r.qualifiedEntityName
117
- ), l = [
118
- c,
119
- m,
120
- o
121
- ].filter(Boolean), d = re(l);
122
- return !d && l.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !s || !d ? { status: "unresolved", reason: "incomplete_source_identity" } : {
123
- status: "resolved",
124
- source: { kind: "physical", connectionId: s, tableName: d }
125
- };
126
- }
127
- function le(e, t) {
128
- const n = y(e.fieldMeta) ? e.fieldMeta : void 0, i = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", a = P(
129
- n == null ? void 0 : n.qualifiedFieldName
130
- ), s = typeof e.column == "string" ? e.column.trim() : "", r = P(s), o = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", c = N(
131
- e.qualifiedTableName
132
- );
133
- if (i && !a || t && o && !c || s.includes(".") && !r)
134
- return { status: "unresolved", reason: "incomplete_field_identity" };
135
- const m = r.split("."), l = r ? m[m.length - 1] : s, d = t && c && l ? `${c}.${l}` : "", f = [
136
- a,
137
- r,
138
- d
139
- ].filter(Boolean);
140
- if (!oe(
141
- f,
142
- se
143
- ))
144
- return { status: "unresolved", reason: "divergent_field_identity" };
145
- const p = r || a || d;
146
- return p ? { status: "resolved", qualifiedFieldName: p } : { status: "unresolved", reason: "incomplete_field_identity" };
147
- }
148
- function fe(e) {
149
- if (!y(e))
150
- return { status: "ineligible", reason: "invalid_input" };
151
- if (e.kind === "global-date")
152
- return { status: "eligible", kind: "global_date" };
153
- const t = E(e.dataType);
154
- if (t !== "date" && t !== "datetime")
155
- return { status: "ineligible", reason: "non_date_filter" };
156
- const n = y(e.fieldMeta) ? e.fieldMeta : void 0, i = E(
157
- n == null ? void 0 : n.dataType
158
- );
159
- if ((n == null ? void 0 : n.dataType) !== void 0 && i !== "date" && i !== "datetime")
160
- return { status: "ineligible", reason: "non_date_filter" };
161
- if (e.customFilterPreferences)
162
- return { status: "ineligible", reason: "custom_filter" };
163
- if (e.targetColumns !== void 0 && (!Array.isArray(e.targetColumns) || e.targetColumns.length > 0))
164
- return { status: "ineligible", reason: "multi_target_filter" };
165
- const a = ue(e), s = le(e, a === void 0);
166
- if (s.status === "unresolved")
167
- return { status: "ineligible", reason: s.reason };
168
- const r = a || ce(e, s.qualifiedFieldName);
169
- return r.status === "resolved" ? {
170
- status: "eligible",
171
- kind: "field_date",
172
- qualifiedFieldName: s.qualifiedFieldName,
173
- source: r.source
174
- } : { status: "ineligible", reason: r.reason };
175
- }
176
- function me(e) {
177
- if (!y(e) || e.kind !== "filter" || !y(e.filter))
178
- return { status: "ineligible", reason: "invalid_input" };
179
- const t = fe(
180
- e.filter
181
- );
182
- return t.status === "ineligible" ? t : t.kind === "field_date" && y(e.compatibility) && e.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : t;
183
- }
184
- function Fe(e) {
185
- return me(e).status === "eligible";
186
- }
187
- function we(e) {
188
- return `compat-filter:${e}`;
189
- }
190
- function ke(e) {
191
- return `compat-control:${e}`;
192
- }
193
- function We(e, t) {
194
- return `compat-inline-filter:${e}:${t}`;
195
- }
196
- function $e(e, t) {
197
- return `compat-card-control:${e}:${t}`;
198
- }
199
- function x(e, t) {
200
- if (e) return e;
201
- const n = t === void 0 ? "unknown" : E(t);
202
- return n === "number" || n === "unknown" ? "SUM" : "COUNT";
203
- }
204
- function ge(e) {
205
- const t = e.aggregate === x(e.semanticAggregate, e.dataType);
206
- return {
207
- effectiveAggregate: e.aggregate,
208
- aggregateSource: t ? e.semanticAggregate ? "semantic_model" : "default_sum" : "caller_override"
209
- };
210
- }
211
- function ye(e, t, n) {
212
- const i = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
213
- return {
214
- aggregate: t,
215
- aggregateOrigin: n,
216
- ...i ? ge({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
217
- };
218
- }
219
- function je(e, t, n) {
220
- return { ...e, ...ye(e, t, n) };
221
- }
222
- function Pe(e) {
223
- return e.aggregate ?? e.effectiveAggregate;
224
- }
225
- function Re(e) {
226
- if (!e.aggregate) return !1;
227
- if (e.aggregateOrigin === "explicit" || e.aggregateSource === "caller_override") return !0;
228
- if (e.aggregateSource) {
229
- const t = e.aggregateSource === "default_sum" ? x(void 0, e.dataType) : e.semanticAggregate ?? e.effectiveAggregate;
230
- return t !== void 0 && e.aggregate !== t;
231
- }
232
- return e.aggregateOrigin !== "default";
233
- }
234
- const qe = ["label", "labelOrigin", "derivedLabel"];
235
- function Le(e) {
236
- return { label: e, labelOrigin: "override", derivedLabel: void 0 };
237
- }
238
- function Ue(e, t) {
239
- const { derivedLabel: n, ...i } = e;
240
- return { ...i, label: t, labelOrigin: "override" };
241
- }
242
- function xe(e, t) {
243
- return e.labelOrigin === "override" ? {} : { label: t, labelOrigin: "semantic" };
244
- }
245
- function ze(e) {
246
- if (e.groupedDate !== void 0) return { target: e.groupedDate, direction: "asc" };
247
- if (!(!e.grouped || e.measures.length === 0))
248
- return { target: e.primaryMeasure ?? e.measures[0], direction: "desc" };
249
- }
250
- const Be = /* @__PURE__ */ new Set([
251
- "contains",
252
- "startsWith",
253
- "endsWith",
254
- "like",
255
- "not like"
256
- ]);
257
- function z(e) {
258
- return e.includes("%") || e.includes("_");
259
- }
260
- function pe(e, t) {
261
- switch (e) {
262
- case "contains":
263
- return { pattern: `%${t}%`, negate: !1 };
264
- case "startsWith":
265
- return { pattern: `${t}%`, negate: !1 };
266
- case "endsWith":
267
- return { pattern: `%${t}`, negate: !1 };
268
- case "like":
269
- return { pattern: t, negate: !1 };
270
- case "not like":
271
- return { pattern: t, negate: !0 };
272
- }
273
- }
274
- function he(e) {
275
- return z(e) ? e : `%${e}%`;
276
- }
277
- function He(e, t) {
278
- const { pattern: n, negate: i } = pe(e, t), a = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, s = a !== void 0 && !z(a) ? a : n;
279
- if (he(s) === n)
280
- return { operator: i ? "not_contains" : "contains", value: s };
281
- }
282
- const M = 864e5, w = {
283
- second: 1e3,
284
- minute: 6e4,
285
- hour: 36e5
286
- };
287
- function O(e, t) {
288
- return {
289
- ...F(e, t),
290
- millisecond: (e.getTime() % 1e3 + 1e3) % 1e3
291
- };
292
- }
293
- function b(e, t) {
294
- return ne(e, t);
295
- }
296
- function T(e) {
297
- const t = new Date(e);
298
- return {
299
- year: t.getUTCFullYear(),
300
- month: t.getUTCMonth() + 1,
301
- day: t.getUTCDate(),
302
- hour: t.getUTCHours(),
303
- minute: t.getUTCMinutes(),
304
- second: t.getUTCSeconds(),
305
- millisecond: t.getUTCMilliseconds()
306
- };
307
- }
308
- function B(e, t) {
309
- const n = /* @__PURE__ */ new Date(0);
310
- return n.setUTCFullYear(e, t, 0), n.getUTCDate();
311
- }
312
- function A(e, t) {
313
- const n = e.year * 12 + (e.month - 1) + t, i = Math.floor(n / 12), a = n - i * 12 + 1;
314
- return { ...e, year: i, month: a, day: Math.min(e.day, B(i, a)) };
315
- }
316
- function _(e, t, n) {
317
- if (t === 0) return e;
318
- switch (n) {
319
- case "second":
320
- case "minute":
321
- case "hour":
322
- return T(
323
- h(e) + t * w[n]
324
- );
325
- case "day":
326
- return T(h(e) + t * M);
327
- case "week":
328
- return T(h(e) + t * 7 * M);
329
- case "month":
330
- return A(e, t);
331
- case "quarter":
332
- return A(e, t * 3);
333
- case "year":
334
- return A(e, t * 12);
335
- }
336
- }
337
- function be(e) {
338
- return new Date(
339
- h({ ...e, hour: 0, minute: 0, second: 0 })
340
- ).getUTCDay();
341
- }
342
- function R(e) {
343
- var n;
344
- const t = (n = e.fiscalCalendar) == null ? void 0 : n.yearStartMonth;
345
- return t && t >= 1 && t <= 12 ? t : 1;
346
- }
347
- function _e(e, t, n) {
348
- const i = { ...e, hour: 0, minute: 0, second: 0, millisecond: 0 };
349
- switch (t) {
350
- case "day":
351
- return i;
352
- case "week":
353
- return _(
354
- i,
355
- -((be(e) - n.weekStart + 7) % 7),
356
- "day"
357
- );
358
- case "month":
359
- return { ...i, day: 1 };
360
- case "quarter": {
361
- const a = (e.month - R(n) + 12) % 12;
362
- return A({ ...i, day: 1 }, -(a % 3));
363
- }
364
- case "year": {
365
- const a = R(n);
366
- return {
367
- ...i,
368
- year: e.month >= a ? e.year : e.year - 1,
369
- month: a,
370
- day: 1
371
- };
372
- }
373
- }
374
- }
375
- function C(e, t, n, i = 0) {
376
- const a = w[t];
377
- if (a !== void 0) {
378
- const o = O(e, n.tz), c = o.millisecond + (t === "second" ? 0 : o.second * 1e3) + (t === "hour" ? o.minute * 6e4 : 0), m = e.getTime() - c + i * a;
379
- return { start: new Date(m), endExclusive: new Date(m + a) };
380
- }
381
- const s = t, r = _(
382
- _e(O(e, n.tz), s, n),
383
- i,
384
- t
385
- );
386
- return {
387
- start: b(r, n.tz),
388
- endExclusive: b(_(r, 1, t), n.tz)
389
- };
390
- }
391
- function q(e, t, n) {
392
- return C(e, t, n).start;
393
- }
394
- function L(e, t, n) {
395
- return new Date(C(e, t, n).endExclusive.getTime() - 1);
396
- }
397
- function ve(e, t, n, i) {
398
- return t === 0 ? e : b(
399
- _(O(e, i.tz), t, n),
400
- i.tz
401
- );
402
- }
403
- function Ze(e, t, n) {
404
- const i = (a) => {
405
- const { year: s, month: r, day: o } = F(a, n);
406
- return h({ year: s, month: r, day: o, hour: 0, minute: 0, second: 0 });
407
- };
408
- return Math.round((i(t) - i(e)) / M);
409
- }
410
- const Ie = /^(\d{4})-(\d{2})-(\d{2})$/;
411
- function Ke(e, t) {
412
- const { year: n, month: i, day: a } = F(e, t);
413
- return `${String(n).padStart(4, "0")}-${String(i).padStart(2, "0")}-${String(a).padStart(2, "0")}`;
414
- }
415
- function H(e) {
416
- const t = Ie.exec(e);
417
- if (!t) return null;
418
- const n = Number(t[1]), i = Number(t[2]), a = Number(t[3]);
419
- return i < 1 || i > 12 || a < 1 || a > B(n, i) ? null : { year: n, month: i, day: a };
420
- }
421
- function Qe(e, t) {
422
- const n = H(e);
423
- if (!n) return null;
424
- const i = { ...n, hour: 0, minute: 0, second: 0, millisecond: 0 };
425
- return {
426
- start: b(i, t),
427
- endExclusive: b(_(i, 1, "day"), t)
428
- };
429
- }
430
- function Ge(e, t, n) {
431
- const i = (s) => new Date(C(n, e.unit, t, s).endExclusive.getTime() - 1), a = (s) => C(n, e.unit, t, s).start;
432
- switch (e.mode) {
433
- case "last":
434
- return e.unit === "minute" || e.unit === "hour" ? {
435
- start: new Date(
436
- n.getTime() - e.n * w[e.unit]
437
- ),
438
- end: n
439
- } : e.complete ? { start: a(-e.n), end: i(-1) } : { start: ve(n, -e.n, e.unit, t), end: n };
440
- case "this": {
441
- if (e.boundary && e.unit === "month") {
442
- const s = e.boundary === "first_day" ? q(n, "month", t) : L(n, "month", t);
443
- return {
444
- start: q(s, "day", t),
445
- end: L(s, "day", t)
446
- };
447
- }
448
- return { start: a(0), end: e.toDate ? n : i(0) };
449
- }
450
- case "previous":
451
- return { start: a(-1), end: i(-1) };
452
- case "between":
453
- return { start: a(e.from), end: i(e.to) };
454
- }
455
- }
456
- function Ye(e) {
457
- const { operation: t, values: n, temporalPrecision: i } = e;
458
- if (t !== "=" && t !== "!=" || i === "minute")
459
- return null;
460
- const a = Array.isArray(n) ? n : [n];
461
- if (a.length !== 1 || typeof a[0] != "string") return null;
462
- const s = a[0].trim();
463
- return H(s) ? { operation: t, day: s } : null;
464
- }
465
- function Ae(e, t) {
466
- const n = e.map((i, a) => `${t[a]} ${De(i)}`);
467
- return u.union(e, {
468
- errorMap: (i, a) => {
469
- if (i.code !== u.ZodIssueCode.invalid_union) return { message: a.defaultError };
470
- const s = i.path.length, r = a.data && typeof a.data == "object" && !Array.isArray(a.data) ? Object.keys(a.data) : [], o = i.unionErrors.map((d, f) => {
471
- const p = Ce(e[f]);
472
- return { index: f, issues: d.issues, overlap: p ? r.filter((v) => p.includes(v)).length : 0 };
473
- }).filter(({ issues: d }) => !d.every((f) => f.code === u.ZodIssueCode.invalid_type && f.path.length === s)).filter(({ overlap: d }) => !r.length || d > 0);
474
- if (!o.length) {
475
- const d = r.length ? ` Its keys (${r.join(", ")}) belong to none of them.` : "";
476
- return { message: `Matches none of: ${n.join("; ")}.${d}` };
477
- }
478
- const c = o.reduce(
479
- (d, f) => f.overlap > d.overlap || f.overlap === d.overlap && f.issues.length < d.issues.length ? f : d
480
- ), m = c.issues.slice(0, 4).map((d) => {
481
- const f = d.path.slice(s).join(".");
482
- return f ? `${d.message} at ${f}` : d.message;
483
- }), l = c.issues.length > 4 ? ` (and ${c.issues.length - 4} more)` : "";
484
- return {
485
- message: `Matches none of: ${n.join("; ")}. Nearest is the ${t[c.index]}: ${m.join("; ")}${l}`
486
- };
487
- }
488
- });
489
- }
490
- function Ce(e) {
491
- let t = e;
492
- for (; t instanceof u.ZodEffects; ) t = t._def.schema;
493
- return t instanceof u.ZodObject ? Object.keys(t.shape) : void 0;
494
- }
495
- function De(e) {
496
- let t = e;
497
- for (; t instanceof u.ZodEffects; ) t = t._def.schema;
498
- return t instanceof u.ZodObject ? `{ ${Object.entries(t.shape).map(([i, a]) => a.isOptional() ? `${i}?` : i).join(", ")} }` : "";
499
- }
500
- function Ve(e = {}) {
501
- const t = (s) => e.strict ? u.object(s).strict() : u.object(s), n = t({
502
- kind: u.literal("relative").optional(),
503
- unit: u.enum(ie),
504
- value: u.number().finite().int().positive(),
505
- anchor: u.enum(V).optional(),
506
- completeness: u.enum(Y).optional()
507
- }).superRefine((s, r) => {
508
- const o = J[s.unit];
509
- s.value > o && r.addIssue({
510
- code: u.ZodIssueCode.too_big,
511
- maximum: o,
512
- inclusive: !0,
513
- type: "number",
514
- path: ["value"],
515
- message: `timeWindow.value must be <= ${o} for unit "${s.unit}".`
516
- });
517
- }), i = t({
518
- kind: u.literal("calendar"),
519
- unit: u.enum(ee),
520
- period: u.enum(X),
521
- toDate: u.boolean().optional()
522
- }).superRefine((s, r) => {
523
- s.toDate && s.period !== "this" && r.addIssue({
524
- code: u.ZodIssueCode.custom,
525
- path: ["toDate"],
526
- message: 'timeWindow.toDate is allowed only with period "this".'
527
- });
528
- }), a = t({
529
- kind: u.literal("absolute"),
530
- start: u.string().min(1),
531
- end: u.string().min(1)
532
- }).superRefine((s, r) => {
533
- const o = $(s.start), c = $(s.end);
534
- o || r.addIssue({
535
- code: u.ZodIssueCode.custom,
536
- path: ["start"],
537
- message: "timeWindow.start must be a valid ISO date or timestamp."
538
- }), c || r.addIssue({
539
- code: u.ZodIssueCode.custom,
540
- path: ["end"],
541
- message: "timeWindow.end must be a valid ISO date or timestamp."
542
- }), o && c && o.getTime() > c.getTime() && r.addIssue({
543
- code: u.ZodIssueCode.custom,
544
- path: ["start"],
545
- message: "timeWindow.start must be before or equal to timeWindow.end."
546
- });
547
- });
548
- return {
549
- relative: n,
550
- calendar: i,
551
- absolute: a,
552
- timeWindow: Ae([n, i, a], ["relative window", "calendar window", "absolute window"])
553
- };
554
- }
555
- function Z(e) {
556
- const { label: t, ...n } = e;
557
- return {
558
- dataset: te(n),
559
- ...e.kind === "physical" ? { dialect: e.dialect, connectionType: e.connectionType } : {}
560
- };
561
- }
562
- function K(e) {
563
- const { label: t, source: n, ...i } = e;
564
- return { ...i, source: n && Z(n) };
565
- }
566
- function k(e) {
567
- const {
568
- label: t,
569
- format: n,
570
- description: i,
571
- tags: a,
572
- inputs: s,
573
- ...r
574
- } = e;
575
- return {
576
- ...r,
577
- inputs: Object.fromEntries(
578
- Object.entries(s).map(([o, c]) => [
579
- o,
580
- { ...c, field: K(c.field) }
581
- ])
582
- )
583
- };
584
- }
585
- function S(e) {
586
- const { derivedField: t, ...n } = e;
587
- return {
588
- ...K(n),
589
- derivedField: t && k(t)
590
- };
591
- }
592
- function D(e) {
593
- const {
594
- label: t,
595
- format: n,
596
- description: i,
597
- semanticTemporalPresentation: a,
598
- derivedField: s,
599
- calculatedFormula: r,
600
- ...o
601
- } = e;
602
- return {
603
- ...o,
604
- semanticTemporalPresentation: a && {
605
- granularity: a.granularity
606
- },
607
- derivedField: s && k(s),
608
- calculatedFormula: r && {
609
- ...r,
610
- inputFields: r.inputFields.map(D)
611
- }
612
- };
613
- }
614
- function Q(e) {
615
- return {
616
- ...e,
617
- conditions: e.conditions.map(
618
- ({ label: t, field: n, ...i }) => ({
619
- ...i,
620
- field: D(n)
621
- })
622
- ),
623
- groups: e.groups.map(Q)
624
- };
625
- }
626
- function Je(e) {
627
- return {
628
- ...e,
629
- source: Z(e.source),
630
- rows: e.rows.map((t) => ({
631
- ...t,
632
- field: S(t.field)
633
- })),
634
- columns: e.columns.map((t) => ({
635
- ...t,
636
- field: S(t.field)
637
- })),
638
- measures: e.measures.map(
639
- (t) => t.kind === "aggregate" ? { ...t, field: S(t.field) } : {
640
- ...t,
641
- definition: k(t.definition)
642
- }
643
- ),
644
- filters: e.filters && Q(e.filters),
645
- joinPlan: e.joinPlan && {
646
- ...e.joinPlan,
647
- // relationshipName participates in governed relationship resolution.
648
- joins: e.joinPlan.joins.map((t) => ({
649
- ...t,
650
- joinKeyGroups: t.joinKeyGroups.map((n) => ({
651
- ...n,
652
- keys: n.keys.map((i) => ({
653
- ...i,
654
- source: D(i.source),
655
- target: D(i.target)
656
- }))
657
- }))
658
- }))
659
- },
660
- // Sort scopes are keyed overrides, unlike ordered axes/calculation inputs.
661
- sorts: [...e.sorts].sort((t, n) => {
662
- const i = j(t), a = j(n);
663
- return i < a ? -1 : i > a ? 1 : 0;
664
- })
665
- };
666
- }
667
- export {
668
- qe as A,
669
- He as B,
670
- O as C,
671
- b as D,
672
- w as E,
673
- B as F,
674
- _ as G,
675
- be as H,
676
- q as I,
677
- L as J,
678
- Ze as K,
679
- Ke as L,
680
- H as M,
681
- Qe as N,
682
- Ge as O,
683
- Ye as P,
684
- Ve as Q,
685
- U as R,
686
- Be as S,
687
- re as T,
688
- k as U,
689
- se as V,
690
- Ae as W,
691
- Je as a,
692
- ae as b,
693
- de as c,
694
- me as d,
695
- we as e,
696
- Oe as f,
697
- xe as g,
698
- ke as h,
699
- Fe as i,
700
- We as j,
701
- $e as k,
702
- x as l,
703
- ye as m,
704
- ge as n,
705
- Pe as o,
706
- C as p,
707
- Re as q,
708
- fe as r,
709
- ve as s,
710
- Le as t,
711
- Ue as u,
712
- ze as v,
713
- je as w,
714
- z as x,
715
- pe as y,
716
- he as z
717
- };