react-semaphor 0.1.558 → 0.1.560

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 (139) hide show
  1. package/dist/analytics-protocol/index.js +368 -358
  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-CHLxsPfX.js +630 -0
  7. package/dist/chunks/{assistant-chat-BCWoP6Rf.js → assistant-chat-Bu2fFm_I.js} +206 -207
  8. package/dist/chunks/{bookmark-state-PjQpxbG7.js → bookmark-state-BFY9oNmr.js} +3 -3
  9. package/dist/chunks/{braces-D5Ucy7q1.js → braces-Da41xfUd.js} +1 -1
  10. package/dist/chunks/{comparison-window-caption-Dc7BaCMz.js → comparison-window-caption-4FNkMrzE.js} +213 -213
  11. package/dist/chunks/{context-DVy4HOU0.js → context-BgPDzLHZ.js} +1 -1
  12. package/dist/chunks/{custom-visual-inputs-B-DLRGrV.js → custom-visual-inputs-Dz-enUNR.js} +1 -1
  13. package/dist/chunks/{dashboard-wK6Bai4V.js → dashboard-_MeBuy67.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-Coqghdn6.js → dashboard-briefing-launcher-CEi4Pr_v.js} +1152 -1166
  15. package/dist/chunks/{dashboard-controls-BYWSM2RM.js → dashboard-controls-Bi7fyG-4.js} +98 -98
  16. package/dist/chunks/{dashboard-json-pPTB5gj0.js → dashboard-json-B1mU_OMa.js} +5 -5
  17. package/dist/chunks/{document-dashboard-inputs-PY_7Xm55.js → document-dashboard-inputs-CkWfDB8c.js} +64 -64
  18. package/dist/chunks/{edit-dashboard-visual-BODxuUeq.js → edit-dashboard-visual-0CJN31Y3.js} +8274 -8514
  19. package/dist/chunks/filter-reach-copy-BF4w4kI2.js +3738 -0
  20. package/dist/chunks/{filter-value-text-CUBpotVN.js → filter-value-text-CRC-K_l_.js} +3 -3
  21. package/dist/chunks/{global-date-filter-utils-BsFqnnbA.js → global-date-filter-utils-D8365uPH.js} +4088 -3416
  22. package/dist/chunks/{index-DP_wQl0v.js → index-DtHidOPV.js} +579 -604
  23. package/dist/chunks/{layout-grid-CkoXmv0L.js → layout-grid-BvsH4RY2.js} +1 -1
  24. package/dist/chunks/{list-filter-B4i25kuc.js → list-filter-Dg0otx5E.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-4GTUDheD.js → matrix-analytical-definition-CM18W8w6.js} +41 -41
  26. package/dist/chunks/{matrix-card-fS_4O7zA.js → matrix-card-HPskLaPy.js} +3 -3
  27. package/dist/chunks/{matrix-member-presentation-Dj7HaAHC.js → matrix-member-presentation-Bbrfrke4.js} +1 -1
  28. package/dist/chunks/{matrix-operation-contract-CpgLZ7E5.js → matrix-operation-contract-WPv4R-H_.js} +130 -130
  29. package/dist/chunks/{metric-comparison-C8LY7GG5.js → metric-comparison-ljMKYZKa.js} +2 -2
  30. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-Ccn1zaxl.js} +1 -1
  31. package/dist/chunks/{palette-stlpjVk4.js → palette-Bsh376zO.js} +1 -1
  32. package/dist/chunks/{pivot-result-contract-expectations-DMk-mKhG.js → pivot-result-contract-expectations-Bl5suy4-.js} +602 -696
  33. package/dist/chunks/{pivot-result-identity-CrQ54Xbj.js → pivot-result-identity-vS9TSh4f.js} +1 -1
  34. package/dist/chunks/{raw-temporal-presentation-BI2z2LlB.js → raw-temporal-presentation-BHm7s-hz.js} +230 -274
  35. package/dist/chunks/{report-preferences-dialog-Dc-YyVwf.js → report-preferences-dialog-BV8L0SeS.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-CohdtiMg.js → report-runtime-context-BZQh9ywy.js} +2 -2
  37. package/dist/chunks/{resolve-dashboard-input-context-BZYI1hB0.js → resolve-dashboard-input-context-CAMiWvyR.js} +2021 -2239
  38. package/dist/chunks/{save-C1dgxgAu.js → save-B5EAsgQF.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-CIBoMq46.js → saved-dashboard-context-n2Wn11cV.js} +57 -57
  40. package/dist/chunks/{selection-reducer-_d6aKJnj.js → selection-reducer-D0YnaAD9.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-ERTLU7B4.js → semaphor-ready-indicator-XLBLOJ2V.js} +38446 -39176
  42. package/dist/chunks/{shelf-drop-preview-context-fEnx6iL_.js → shelf-drop-preview-context-DHMa54a-.js} +570 -570
  43. package/dist/chunks/source-entity-resolution-dUG5VWRm.js +607 -0
  44. package/dist/chunks/{switch-BqUan2mN.js → switch-ByxH4M7t.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-CTCTA_bd.js → table-export-sheet-C_GdeTYU.js} +1 -1
  46. package/dist/chunks/{table-settings-DF1gdVQR.js → table-settings-Imz0FgWi.js} +8 -8
  47. package/dist/chunks/{temporal-input-presentation-DoSniQj1.js → temporal-input-presentation-uvNK_tM0.js} +1109 -820
  48. package/dist/chunks/{token-types-DFyLflLY.js → token-types-CQtXUVMy.js} +1 -1
  49. package/dist/chunks/{upload-DcoyjkRV.js → upload-wbR-NVzq.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-xhb9YFg-.js → use-create-flow-overlay-state-CEBaLOKC.js} +6 -6
  51. package/dist/chunks/validators-CXTneCA4.js +3453 -0
  52. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-B1n_WjW3.js} +1 -1
  53. package/dist/dashboard/index.js +2 -2
  54. package/dist/dashboard-authoring/index.js +2207 -1496
  55. package/dist/data-app-sdk/index.js +20 -20
  56. package/dist/data-app-sdk-adapters/index.js +3 -3
  57. package/dist/data-app-sdk-validation/index.js +6 -6
  58. package/dist/format-utils/index.js +181 -176
  59. package/dist/index.js +22 -22
  60. package/dist/report-runtime-context/index.js +2 -2
  61. package/dist/style.css +1 -1
  62. package/dist/surfboard/index.js +2 -2
  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 +6 -6
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  68. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  69. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  70. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  71. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  72. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  73. package/dist/types/lib/stores/editor-store.d.ts +39 -9
  74. package/dist/types/lib/stores/table-actions.d.ts +9 -3
  75. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  76. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  79. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  80. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  81. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  82. package/dist/types/lib/types/common-types.d.ts +40 -47
  83. package/dist/types/lib/types/explorer-types.d.ts +13 -44
  84. package/dist/types/lib/utils/card-config-utils.d.ts +9 -1
  85. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  86. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +159 -513
  87. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  88. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  89. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  90. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  91. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  92. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  93. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  94. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  95. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  96. package/dist/types/shared/analytics-protocol/source-capabilities.d.ts +21 -0
  97. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  98. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  99. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  100. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  101. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  102. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  103. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +24 -24
  104. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  105. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  106. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  107. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +14 -0
  108. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  109. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  110. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  111. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  112. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  113. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  114. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  115. package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +2 -0
  116. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  117. package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +4 -2
  118. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  119. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  120. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  121. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  122. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -1
  123. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  124. package/dist/types/shared/format-utils/index.d.ts +2 -0
  125. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  126. package/dist/types/shared/format-utils/raw-temporal.d.ts +15 -1
  127. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  128. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  129. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  130. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  131. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  132. package/package.json +1 -1
  133. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  134. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  135. package/dist/chunks/filter-reach-copy-BvJH9JO-.js +0 -3411
  136. package/dist/chunks/source-entity-resolution-DXW1HpKf.js +0 -816
  137. package/dist/chunks/validators-hmfNNQz8.js +0 -3595
  138. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  139. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -0,0 +1,68 @@
1
+ import { TFormatOptions } from '../../lib/types/common-types.js';
2
+ import { CanonicalDurationUnit } from './types/index.js';
3
+ import { AdaptedCanonicalFormatSpec, CanonicalAdapterOptions } from './semantic-format.js';
4
+ /** A stored `preferences.numberAxisFormat`. */
5
+ type RetiredNumberAxisFormat = {
6
+ decimalPlaces?: number;
7
+ minimumFractionDigits?: number;
8
+ maximumFractionDigits?: number;
9
+ suffix?: string;
10
+ currency?: string;
11
+ locale?: string;
12
+ useGrouping?: boolean;
13
+ percentValueMode?: 'fraction' | 'whole';
14
+ };
15
+ /** A stored table column number format (`columnSettingsMap[key].numberFormat`). */
16
+ export type RetiredColumnNumberFormat = {
17
+ style?: 'decimal' | 'currency' | 'percent' | 'scientific' | 'duration';
18
+ currency?: string;
19
+ locale?: string;
20
+ minimumFractionDigits?: number;
21
+ maximumFractionDigits?: number;
22
+ useGrouping?: boolean;
23
+ percentValueMode?: 'fraction' | 'whole';
24
+ scale?: number;
25
+ compact?: boolean;
26
+ negativeStyle?: 'minus' | 'parentheses';
27
+ signDisplay?: 'auto' | 'always' | 'exceptZero' | 'never';
28
+ prefix?: string;
29
+ suffix?: string;
30
+ duration?: {
31
+ inputUnit?: CanonicalDurationUnit;
32
+ outputStyle?: 'compact' | 'digital' | 'long';
33
+ largestUnit?: CanonicalDurationUnit;
34
+ smallestUnit?: CanonicalDurationUnit;
35
+ maxUnits?: number;
36
+ };
37
+ showDataBar?: boolean;
38
+ dataBarColor?: string;
39
+ dataBarMinValue?: number;
40
+ dataBarMaxValue?: number;
41
+ showHeatmap?: boolean;
42
+ };
43
+ export type LegacyFormatNumber = {
44
+ decimalPlaces?: number;
45
+ minimumFractionDigits?: number;
46
+ maximumFractionDigits?: number;
47
+ currency?: string;
48
+ locale?: string;
49
+ prefix?: string;
50
+ suffix?: string;
51
+ useGrouping?: boolean;
52
+ percentValueMode?: 'fraction' | 'whole';
53
+ enabled?: boolean | string;
54
+ };
55
+ export declare function fromTFormatOptions(format?: TFormatOptions | null, options?: CanonicalAdapterOptions): AdaptedCanonicalFormatSpec | undefined;
56
+ export declare function fromPersistedKpiFormatOptions(format?: TFormatOptions): AdaptedCanonicalFormatSpec | undefined;
57
+ export declare function fromLegacyFormatNumber(format?: LegacyFormatNumber | null): AdaptedCanonicalFormatSpec | undefined;
58
+ export declare function fromNumberAxisFormat(format?: RetiredNumberAxisFormat | null): AdaptedCanonicalFormatSpec | undefined;
59
+ export declare function fromColumnNumberFormat(format?: RetiredColumnNumberFormat | null, options?: CanonicalAdapterOptions): AdaptedCanonicalFormatSpec | undefined;
60
+ export declare function isHistoricalPersistedColumnNumberFormat(format?: RetiredColumnNumberFormat | null): boolean;
61
+ /**
62
+ * Reads the persisted table-column contract. The old settings editor seeded
63
+ * currency, locale, and data-bar leaves together; that bounded legacy shape
64
+ * rendered omitted precision with the table formatter's 0-2 fallback. Newly
65
+ * sparse formats do not match it and retain currency-minor-unit precision.
66
+ */
67
+ export declare function fromPersistedColumnNumberFormat(format?: RetiredColumnNumberFormat | null): AdaptedCanonicalFormatSpec | undefined;
68
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { SemaphorValueFormat } from '../analytics-protocol/index.js';
2
- import { CanonicalFormatSpec, CanonicalDurationUnit as DurationUnit, NumericCanonicalFormat, RawTemporalFormat } from './types/index.js';
2
+ import { CanonicalFormatSpec, CanonicalDurationUnit as DurationUnit, DateCanonicalFormat, NumericCanonicalFormat, RawTemporalFormat } from './types/index.js';
3
3
  export type AdaptedCanonicalFormatSpec = Exclude<CanonicalFormatSpec, RawTemporalFormat>;
4
4
  type LegacySemanticFormat = {
5
5
  type?: 'number' | 'currency' | 'percentage' | 'percent' | 'scientific' | 'date' | 'duration' | 'string';
@@ -16,7 +16,10 @@ type LegacySemanticFormat = {
16
16
  compact?: boolean;
17
17
  scale?: number;
18
18
  percentValueMode?: 'fraction' | 'whole';
19
+ signDisplay?: 'auto' | 'always' | 'exceptZero' | 'never';
19
20
  pattern?: string;
21
+ dialect?: DateCanonicalFormat['dialect'];
22
+ preset?: DateCanonicalFormat['preset'];
20
23
  relative?: boolean;
21
24
  timezone?: string;
22
25
  sourceTimezone?: string;
@@ -32,6 +35,7 @@ export type CanonicalAdapterOptions = {
32
35
  numericInput?: 'canonical';
33
36
  };
34
37
  export declare const DEFAULT_LOCALE = "en-US";
38
+ export declare function isHistoricalCodelessCurrencyFormat(format: LegacySemanticFormat): boolean;
35
39
  export declare function normalizeLocaleOrCurrency(value: unknown): string | undefined;
36
40
  export declare function normalizeNumericFormat(type: NumericCanonicalFormat['type'], format: LegacySemanticFormat, options?: CanonicalAdapterOptions): NumericCanonicalFormat;
37
41
  export declare function normalizeDateFormat(format: LegacySemanticFormat): Extract<CanonicalFormatSpec, {
@@ -0,0 +1,16 @@
1
+ import { SemaphorNumericValueFormat, SemaphorValueFormat } from '../analytics-protocol/contracts.js';
2
+ /**
3
+ * A percent with `scale` shows `value × scale × 100 %` (fraction) or
4
+ * `value × scale %` (whole) today. Stored as a number with that multiplier
5
+ * and a `%` suffix, it shows the same; `compact` goes (percent ignores it) and
6
+ * the digits become explicit (percent's default is one). `scale: 1` on a
7
+ * whole percent multiplies by nothing, so it stays a plain percent.
8
+ */
9
+ export declare function percentWithScaleAsNumber(format: SemaphorNumericValueFormat & {
10
+ scale: number;
11
+ }): SemaphorNumericValueFormat;
12
+ /**
13
+ * Converts a runtime or partly stored format to the stored type, or returns
14
+ * undefined for anything that is not a format.
15
+ */
16
+ export declare function toStoredValueFormat(format: unknown): SemaphorValueFormat | undefined;
@@ -1,4 +1,4 @@
1
- import { TemporalBucketFormat } from '../../analytics-protocol/contracts.js';
1
+ import { RawDatePreset, TemporalBucketFormat } from '../../analytics-protocol/contracts.js';
2
2
  export type NumericCanonicalFormat = {
3
3
  type: 'number' | 'currency' | 'percent' | 'scientific';
4
4
  locale?: string;
@@ -12,11 +12,15 @@ export type NumericCanonicalFormat = {
12
12
  scale?: number;
13
13
  currency?: string;
14
14
  percentValueMode?: 'fraction' | 'whole';
15
+ signDisplay?: 'auto' | 'always' | 'exceptZero' | 'never';
15
16
  };
16
17
  export type DateCanonicalFormat = {
17
18
  type: 'date';
18
19
  locale?: string;
19
20
  pattern?: string;
21
+ /** The pattern's token set; absent means Semaphor tokens. */
22
+ dialect?: RawTemporalPatternDialect;
23
+ preset?: RawDatePreset;
20
24
  relative?: boolean;
21
25
  timezone?: string;
22
26
  sourceTimezone?: string;
@@ -37,6 +41,11 @@ export type RawTemporalFormat = {
37
41
  mode: 'pattern';
38
42
  dialect: RawTemporalPatternDialect;
39
43
  pattern: string;
44
+ }
45
+ /** A named preset (column formats CF-D16). */
46
+ | {
47
+ mode: 'preset';
48
+ preset: 'short' | 'long' | 'numeric' | 'iso';
40
49
  };
41
50
  };
42
51
  export type CanonicalDurationUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
@@ -140,10 +149,6 @@ export interface ColumnSettings {
140
149
  negativeStyle?: 'minus' | 'parentheses';
141
150
  /** Duration options; read only when `style` is `duration`. */
142
151
  duration?: ColumnDurationFormat;
143
- showDataBar?: boolean;
144
- dataBarColor?: string;
145
- dataBarMinValue?: number;
146
- dataBarMaxValue?: number;
147
152
  };
148
153
  dateFormat?: {
149
154
  format: string;
@@ -160,15 +165,8 @@ export interface ColumnSettings {
160
165
  labelColumn?: string;
161
166
  openInNewTab: boolean;
162
167
  };
163
- colorRanges?: ColorRange[];
164
168
  }
165
169
  export type ColumnSettingsMap = Record<string, ColumnSettings>;
166
- export interface ColorRange {
167
- min: number;
168
- max: number;
169
- color: string;
170
- applyTo: 'cell' | 'row';
171
- }
172
170
  export interface ExportFormattingConfig {
173
171
  /** Whether to apply formatting or export raw values */
174
172
  useFormattedValues: boolean;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.558",
8
+ "version": "0.1.560",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,472 +0,0 @@
1
- import { z as e } from "zod";
2
- const T = [
3
- "missing_dependency",
4
- "missing_relationship",
5
- "population_required",
6
- "ambiguous_relationship"
7
- ];
8
- function $(a) {
9
- return T.includes(
10
- a
11
- );
12
- }
13
- const W = 200, b = [
14
- "second",
15
- "minute",
16
- "hour",
17
- "day",
18
- "week",
19
- "month",
20
- "quarter",
21
- "year"
22
- ];
23
- function X(a) {
24
- return typeof a == "string" && b.includes(a);
25
- }
26
- const j = [
27
- "week_of_short",
28
- "week_of_long",
29
- "quarter_short",
30
- "quarter_long",
31
- "fiscal_quarter_short",
32
- "fiscal_year"
33
- ], J = {
34
- invalidMetadata: "invalid_raw_temporal_metadata"
35
- };
36
- function v(a) {
37
- return a === "second" || a === "minute" || a === "hour" ? "datetime" : "date";
38
- }
39
- const Y = {
40
- missingMetadata: "missing_temporal_bucket_metadata",
41
- invalidMetadata: "invalid_temporal_bucket_metadata",
42
- invalidValue: "invalid_temporal_bucket_value"
43
- }, Q = "__auto_count__";
44
- function I(a) {
45
- try {
46
- return new Intl.DateTimeFormat("en-US", { timeZone: a }).format(), !0;
47
- } catch {
48
- return !1;
49
- }
50
- }
51
- const w = e.record(e.string(), e.unknown()), i = e.array(w), r = e.enum([
52
- "SUM",
53
- "COUNT",
54
- "AVG",
55
- "MIN",
56
- "MAX",
57
- "MEDIAN",
58
- "DISTINCT"
59
- ]), s = e.enum([
60
- "postgres",
61
- "mysql",
62
- "mssql",
63
- "snowflake",
64
- "clickhouse",
65
- "bigquery",
66
- "redshift",
67
- "duckdb",
68
- "sqlite",
69
- "unknown"
70
- ]), C = e.enum(b), l = e.enum([
71
- "dimension",
72
- "measure",
73
- "date",
74
- "id",
75
- "unknown"
76
- ]), p = e.enum([
77
- "string",
78
- "number",
79
- "boolean",
80
- "date",
81
- "datetime",
82
- "unknown"
83
- ]), u = e.union([e.number(), e.string(), e.null()]), d = e.enum([
84
- "millisecond",
85
- "second",
86
- "minute",
87
- "hour",
88
- "day"
89
- ]), O = e.enum(j), q = e.discriminatedUnion("mode", [
90
- e.object({ mode: e.literal("auto") }).strict(),
91
- e.object({
92
- mode: e.literal("preset"),
93
- preset: O
94
- }).strict(),
95
- e.object({
96
- mode: e.literal("pattern"),
97
- pattern: e.string().min(1)
98
- }).strict()
99
- ]), ee = e.object({
100
- type: e.literal("temporal_bucket"),
101
- presentation: q
102
- }).strict(), A = e.object({
103
- tz: e.string().min(1).refine(I, {
104
- message: "tz must be a valid IANA timezone"
105
- }),
106
- weekStart: e.number().int().min(0).max(6),
107
- fiscalCalendar: e.object({
108
- kind: e.literal("month_aligned"),
109
- yearStartMonth: e.number().int().min(1).max(12)
110
- }).strict().optional()
111
- }).strict(), g = e.object({
112
- kind: e.literal("temporal_bucket"),
113
- granularity: C,
114
- calendar: A
115
- }).strict(), D = e.object({
116
- kind: e.literal("raw_temporal"),
117
- valueKind: e.enum(["date", "wall_datetime", "instant"])
118
- }).strict(), E = e.union([
119
- e.object({
120
- type: e.enum([
121
- "number",
122
- "currency",
123
- "percent",
124
- "percentage",
125
- "scientific"
126
- ]),
127
- locale: e.string().optional(),
128
- minimumFractionDigits: e.number().optional(),
129
- maximumFractionDigits: e.number().optional(),
130
- useGrouping: e.boolean().optional(),
131
- prefix: e.string().optional(),
132
- suffix: e.string().optional(),
133
- negativeStyle: e.enum(["minus", "parentheses"]).optional(),
134
- compact: e.boolean().optional(),
135
- scale: e.number().optional(),
136
- currency: e.string().optional(),
137
- percentValueMode: e.enum(["fraction", "whole"]).optional()
138
- }).passthrough().superRefine((a, t) => {
139
- "locale" in a && t.addIssue({
140
- code: e.ZodIssueCode.custom,
141
- path: ["locale"],
142
- message: "Numeric semantic formats inherit locale from viewer preferences."
143
- });
144
- }),
145
- e.object({
146
- type: e.enum(["date", "datetime"]),
147
- locale: e.string().optional(),
148
- pattern: e.string().optional(),
149
- relative: e.boolean().optional(),
150
- timezone: e.string().optional(),
151
- sourceTimezone: e.string().optional(),
152
- prefix: e.string().optional(),
153
- suffix: e.string().optional()
154
- }).passthrough(),
155
- e.object({
156
- type: e.literal("duration"),
157
- inputUnit: d.optional(),
158
- outputStyle: e.enum(["compact", "digital", "long"]).optional(),
159
- largestUnit: d.optional(),
160
- smallestUnit: d.optional(),
161
- maxUnits: e.number().optional(),
162
- prefix: e.string().optional(),
163
- suffix: e.string().optional(),
164
- negativeStyle: e.enum(["minus", "parentheses"]).optional()
165
- }).passthrough(),
166
- e.object({
167
- type: e.literal("string"),
168
- prefix: e.string().optional(),
169
- suffix: e.string().optional()
170
- }).passthrough()
171
- ]);
172
- function M(a, t) {
173
- return e.object(a).passthrough().superRefine((o, k) => {
174
- for (const m of t)
175
- Object.prototype.hasOwnProperty.call(o, m) || k.addIssue({
176
- code: "custom",
177
- path: [m],
178
- message: `Required field "${m}" is missing.`
179
- });
180
- });
181
- }
182
- const y = e.object({
183
- kind: e.literal("semantic"),
184
- domainId: e.string(),
185
- datasetName: e.string(),
186
- datasetId: e.string().optional(),
187
- label: e.string().optional(),
188
- connectionId: e.string().optional()
189
- }).passthrough(), N = e.object({
190
- kind: e.literal("physical"),
191
- connectionId: e.string(),
192
- connectionType: e.string().optional(),
193
- tableName: e.string(),
194
- databaseName: e.string().optional(),
195
- schemaName: e.string().optional(),
196
- label: e.string().optional(),
197
- dialect: s.optional()
198
- }).passthrough(), P = e.object({
199
- kind: e.literal("sql"),
200
- connectionId: e.string(),
201
- dialect: s.optional(),
202
- label: e.string().optional()
203
- }).passthrough(), S = e.union([
204
- y,
205
- N,
206
- P
207
- ]), F = e.object({
208
- name: e.string(),
209
- label: e.string().optional(),
210
- role: l.optional(),
211
- dataType: p.optional(),
212
- source: S.optional(),
213
- aggregate: r.optional()
214
- }).passthrough(), _ = F, x = e.object({
215
- kind: e.literal("field"),
216
- field: _,
217
- aggregate: r.optional()
218
- }).passthrough(), B = e.object({
219
- kind: e.literal("derived_field"),
220
- name: e.string(),
221
- label: e.string(),
222
- description: e.string().optional(),
223
- resultRole: l,
224
- dataType: p,
225
- computeStage: e.enum(["row", "aggregate"]),
226
- expression: e.string(),
227
- expressionLanguage: e.literal("semaphor_sql_template").optional(),
228
- inputs: e.record(x),
229
- defaultAggregate: r.optional(),
230
- aggregationBehavior: e.enum([
231
- "additive",
232
- "non_additive",
233
- "ratio_of_sums",
234
- "weighted",
235
- "pre_aggregated",
236
- "snapshot"
237
- ]).optional(),
238
- aggregationStrategy: e.enum([
239
- "default",
240
- "symmetric_aggregate",
241
- "aggregate_then_join",
242
- "weighted"
243
- ]).optional(),
244
- format: E.optional(),
245
- tags: e.array(e.string()).optional()
246
- }).passthrough(), f = B, ae = _.and(
247
- e.object({
248
- derivedField: f.optional()
249
- }).passthrough()
250
- ), U = y, V = e.object({
251
- kind: e.literal("physical"),
252
- connectionId: e.string().optional(),
253
- connectionType: e.string().optional(),
254
- tableName: e.string(),
255
- databaseName: e.string().optional(),
256
- schemaName: e.string().optional(),
257
- label: e.string().optional(),
258
- dialect: s.optional()
259
- }).passthrough(), z = e.object({
260
- kind: e.literal("sql"),
261
- connectionId: e.string().optional(),
262
- dialect: s.optional(),
263
- label: e.string().optional()
264
- }).passthrough(), G = e.union([
265
- U,
266
- V,
267
- z
268
- ]), te = e.object({
269
- key: e.string().optional(),
270
- name: e.string(),
271
- label: e.string().optional(),
272
- role: l.optional(),
273
- dataType: p.optional(),
274
- source: G.optional(),
275
- aggregate: r.optional(),
276
- derivedField: e.never().optional()
277
- }).passthrough(), n = e.object({
278
- key: e.string(),
279
- name: e.string(),
280
- label: e.string(),
281
- role: l.optional(),
282
- dataType: p.optional(),
283
- aggregate: r.optional(),
284
- source: S.optional(),
285
- derivedField: f.optional(),
286
- temporalBucket: g.optional(),
287
- rawTemporal: D.optional(),
288
- pivotIdentity: e.object({
289
- metricId: e.string().min(1),
290
- metricAlias: e.string().min(1),
291
- members: e.array(
292
- e.object({
293
- fieldId: e.string().min(1),
294
- value: e.string().nullable(),
295
- temporalBucket: g.optional()
296
- }).strict()
297
- )
298
- }).strict().optional()
299
- }).passthrough().superRefine((a, t) => {
300
- if (a.temporalBucket && a.rawTemporal && t.addIssue({
301
- code: e.ZodIssueCode.custom,
302
- path: ["rawTemporal"],
303
- message: "A result column cannot carry both temporalBucket and rawTemporal metadata."
304
- }), a.temporalBucket) {
305
- const o = v(
306
- a.temporalBucket.granularity
307
- );
308
- a.dataType !== o && t.addIssue({
309
- code: e.ZodIssueCode.custom,
310
- path: ["dataType"],
311
- message: `${a.temporalBucket.granularity} temporal buckets require dataType ${o}.`
312
- });
313
- }
314
- if (a.rawTemporal) {
315
- const o = a.rawTemporal.valueKind === "date" ? "date" : "datetime";
316
- a.dataType !== o && t.addIssue({
317
- code: e.ZodIssueCode.custom,
318
- path: ["dataType"],
319
- message: `${a.rawTemporal.valueKind} raw temporal values require dataType ${o}.`
320
- });
321
- }
322
- }), oe = e.object({
323
- records: i,
324
- columns: e.array(n).optional()
325
- }).passthrough(), ne = e.object({
326
- records: i,
327
- columns: e.array(n)
328
- }).passthrough(), R = e.object({
329
- code: e.string(),
330
- message: e.string().optional(),
331
- invalidField: e.string().optional(),
332
- fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
333
- validMeasureCandidates: e.array(e.string()).optional(),
334
- validDateCandidates: e.array(e.string()).optional(),
335
- validDimensionCandidates: e.array(e.string()).optional(),
336
- recommendedNextStep: e.string()
337
- }).passthrough(), h = e.object({
338
- code: e.string(),
339
- message: e.string(),
340
- path: e.string().optional(),
341
- fieldRole: e.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
342
- repairHint: R.optional()
343
- }).passthrough(), ie = e.object({
344
- ok: e.boolean(),
345
- errors: e.array(h),
346
- warnings: e.array(h),
347
- repairHints: e.array(R)
348
- }).passthrough(), L = e.object({
349
- page: e.number(),
350
- pageSize: e.number(),
351
- pageCount: e.number(),
352
- totalCount: e.number(),
353
- hasNextPage: e.boolean(),
354
- hasPrevPage: e.boolean()
355
- }).passthrough(), c = {
356
- intentId: e.string().optional(),
357
- queryPath: e.enum(["query_spec", "sql", "sql_python"]),
358
- warnings: e.array(e.string()).optional(),
359
- rowCount: e.number().optional(),
360
- rowLimitExceeded: e.boolean().optional(),
361
- limit: e.number().optional(),
362
- pagination: L.optional()
363
- }, re = e.object({
364
- ...c,
365
- kind: e.literal("metric"),
366
- primaryValue: u,
367
- measures: e.record(u).optional(),
368
- missingMeasures: e.array(e.string()).optional(),
369
- comparison: e.object({
370
- kind: e.enum(["previous_period", "previous_year", "target"]),
371
- value: u.optional(),
372
- delta: e.union([e.number(), e.null()]).optional(),
373
- deltaPercent: e.union([e.number(), e.null()]).optional()
374
- }).passthrough().optional(),
375
- records: i.optional()
376
- }).passthrough(), se = e.object({
377
- ...c,
378
- kind: e.literal("records"),
379
- columns: e.array(n),
380
- records: i,
381
- totals: e.object({
382
- mode: e.literal("server"),
383
- scope: e.literal("filtered_result"),
384
- row: e.record(e.string(), e.unknown()),
385
- columns: e.array(n).optional()
386
- }).passthrough().optional()
387
- }).passthrough(), H = e.object({
388
- inputId: e.string().min(1),
389
- status: e.enum(["applied", "inactive", "skipped", "overridden", "error"]),
390
- reason: e.enum([
391
- "unrelated",
392
- "population_required",
393
- "missing_dependency",
394
- "missing_relationship",
395
- "ambiguous_relationship",
396
- "invalid_metadata",
397
- "unsupported_dependency",
398
- "override_not_eligible"
399
- ]).optional()
400
- }), Z = e.object({
401
- complete: e.boolean(),
402
- reason: e.enum(["unsupported", "truncated"]).optional()
403
- }), le = e.object({
404
- ...c,
405
- kind: e.literal("inputOptions"),
406
- dependencyOutcomes: e.array(H).optional(),
407
- match: Z.optional(),
408
- options: e.array(
409
- M(
410
- {
411
- label: e.string(),
412
- value: e.unknown(),
413
- count: e.number().optional(),
414
- disambiguation: e.array(e.string()).optional()
415
- },
416
- ["value"]
417
- )
418
- )
419
- }).passthrough(), pe = e.object({
420
- ...c,
421
- kind: e.literal("sql"),
422
- columns: e.array(n),
423
- records: i,
424
- sqlShape: e.object({
425
- statementType: e.string().optional(),
426
- explicitLimit: e.number().optional(),
427
- hasPythonCode: e.boolean().optional()
428
- }).passthrough().optional()
429
- }).passthrough();
430
- export {
431
- oe as A,
432
- ne as B,
433
- h as C,
434
- ie as D,
435
- re as E,
436
- se as F,
437
- H as G,
438
- Z as H,
439
- le as I,
440
- pe as J,
441
- W as M,
442
- T as O,
443
- J as R,
444
- Q as S,
445
- Y as T,
446
- g as a,
447
- $ as b,
448
- b as c,
449
- X as d,
450
- j as e,
451
- i as f,
452
- r as g,
453
- C as h,
454
- I as i,
455
- ee as j,
456
- D as k,
457
- E as l,
458
- y as m,
459
- u as n,
460
- N as o,
461
- P as p,
462
- F as q,
463
- w as r,
464
- S as s,
465
- v as t,
466
- _ as u,
467
- B as v,
468
- f as w,
469
- ae as x,
470
- te as y,
471
- n as z
472
- };
@@ -1,15 +0,0 @@
1
- const e = /* @__PURE__ */ new Set();
2
- function t(r) {
3
- return e.add(r), () => {
4
- e.delete(r);
5
- };
6
- }
7
- function n() {
8
- e.forEach((r) => {
9
- r();
10
- });
11
- }
12
- export {
13
- n as f,
14
- t as r
15
- };