react-semaphor 0.1.556 → 0.1.557

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 (75) hide show
  1. package/DATA_APP_SDK.md +6 -29
  2. package/dist/analytics-protocol/index.js +19 -20
  3. package/dist/assistant-context/index.js +1 -1
  4. package/dist/brand-studio/index.js +28 -29
  5. package/dist/briefings/index.js +55 -56
  6. package/dist/chunks/{assistant-chat-C7Acww1T.js → assistant-chat-WMTpYirZ.js} +78 -80
  7. package/dist/chunks/{bookmark-state-7iZErWnR.js → bookmark-state-PjQpxbG7.js} +3 -3
  8. package/dist/chunks/{braces-o9UiRQes.js → braces-BOErQVyi.js} +1 -1
  9. package/dist/chunks/{comparison-window-caption-BseG5aOZ.js → comparison-window-caption-Dc7BaCMz.js} +186 -189
  10. package/dist/chunks/{custom-visual-inputs-ChuKjx27.js → custom-visual-inputs-CxYI-gFa.js} +1 -1
  11. package/dist/chunks/{dashboard-BU6rE5kV.js → dashboard-4D8Vy4pL.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-qrYd2zkN.js → dashboard-briefing-launcher-C4EmOfxs.js} +147 -149
  13. package/dist/chunks/{dashboard-controls-BsapXI2H.js → dashboard-controls-DBWykmvL.js} +170 -172
  14. package/dist/chunks/{dashboard-json-CJqPqYnI.js → dashboard-json-DiX-p0F7.js} +20 -21
  15. package/dist/chunks/{document-dashboard-inputs-BNSprf5_.js → document-dashboard-inputs-DP5hquBR.js} +30 -30
  16. package/dist/chunks/{edit-dashboard-visual-CjAdV-WG.js → edit-dashboard-visual-n1jLV_7V.js} +4773 -4802
  17. package/dist/chunks/{filter-reach-copy-BTrqtFkh.js → filter-reach-copy-BB9iakLA.js} +147 -148
  18. package/dist/chunks/{filter-value-text-CJTJDCym.js → filter-value-text-CUBpotVN.js} +3 -3
  19. package/dist/chunks/{global-date-filter-utils-CTVf3dG3.js → global-date-filter-utils-Cc5tqkoW.js} +585 -591
  20. package/dist/chunks/{index-B_vIRa-q.js → index-CgjhzkKM.js} +69 -70
  21. package/dist/chunks/{layout-grid-Bgzth8vd.js → layout-grid-CcNklCwL.js} +1 -1
  22. package/dist/chunks/{list-filter-DsaTbM3J.js → list-filter-Ds_4UTpD.js} +1 -1
  23. package/dist/chunks/{matrix-analytical-definition-Cg0ioFGQ.js → matrix-analytical-definition-4GTUDheD.js} +3 -3
  24. package/dist/chunks/{matrix-card-yYibXSw1.js → matrix-card-fS_4O7zA.js} +2 -2
  25. package/dist/chunks/{matrix-member-presentation-DEEauKXC.js → matrix-member-presentation-Dj7HaAHC.js} +1 -1
  26. package/dist/chunks/{matrix-operation-contract-C1G6AJNh.js → matrix-operation-contract-CpgLZ7E5.js} +21 -21
  27. package/dist/chunks/{metric-comparison-BfcmwxM1.js → metric-comparison-C8LY7GG5.js} +1 -1
  28. package/dist/chunks/{palette-D10o_yYX.js → palette-DMkIhagj.js} +1 -1
  29. package/dist/chunks/{matrix-formatter-C2kjsCDf.js → pivot-result-contract-expectations-DMk-mKhG.js} +444 -395
  30. package/dist/chunks/{pivot-result-identity-CWi5WrrY.js → pivot-result-identity-CrQ54Xbj.js} +1 -1
  31. package/dist/chunks/{raw-temporal-presentation-DWzLIHc3.js → raw-temporal-presentation-DdEpgPRB.js} +24 -25
  32. package/dist/chunks/report-preferences-dialog-CFg5VFLk.js +2109 -0
  33. package/dist/chunks/{report-runtime-context-BgM-iNWB.js → report-runtime-context-CohdtiMg.js} +1 -1
  34. package/dist/chunks/{resolve-dashboard-input-context-Df8V5QHW.js → resolve-dashboard-input-context-Djl3kCFL.js} +224 -226
  35. package/dist/chunks/{save-CfJpQQ68.js → save-D1EpMcwT.js} +1 -1
  36. package/dist/chunks/{saved-dashboard-context-VvXI6r03.js → saved-dashboard-context-umlQFevH.js} +8 -8
  37. package/dist/chunks/selection-reducer-_d6aKJnj.js +46 -0
  38. package/dist/chunks/{semaphor-ready-indicator-fejZmdq9.js → semaphor-ready-indicator-4cOp6sla.js} +40458 -43400
  39. package/dist/chunks/{shelf-drop-preview-context-BuTCXe-S.js → shelf-drop-preview-context-DAtRuvR7.js} +6 -6
  40. package/dist/chunks/{source-entity-resolution-B46EZIzX.js → source-entity-resolution-DXW1HpKf.js} +1 -1
  41. package/dist/chunks/{switch-Bq92UGId.js → switch-9CJt5EF_.js} +1430 -1341
  42. package/dist/chunks/{table-export-sheet-noKl8-en.js → table-export-sheet-CTCTA_bd.js} +1 -1
  43. package/dist/chunks/{table-settings-PpINOzw8.js → table-settings-DF1gdVQR.js} +2 -2
  44. package/dist/chunks/temporal-input-presentation-DoSniQj1.js +2939 -0
  45. package/dist/chunks/{token-types--0bgRCaO.js → token-types-DFyLflLY.js} +1 -1
  46. package/dist/chunks/{upload-BFX7apKV.js → upload-LSNKpt0w.js} +1 -1
  47. package/dist/chunks/{use-create-flow-overlay-state-Cz-ve64t.js → use-create-flow-overlay-state-esyMT9vU.js} +124 -126
  48. package/dist/chunks/{validators-CZo_H4E6.js → validators-hmfNNQz8.js} +5 -5
  49. package/dist/chunks/zoned-wall-clock-E35Frf9v.js +191 -0
  50. package/dist/dashboard/index.js +2 -2
  51. package/dist/dashboard-authoring/index.js +130 -131
  52. package/dist/data-app-sdk/index.js +788 -4153
  53. package/dist/data-app-sdk-adapters/index.js +2 -2
  54. package/dist/data-app-sdk-validation/index.js +5 -5
  55. package/dist/format-utils/index.js +230 -233
  56. package/dist/index.js +216 -217
  57. package/dist/report-runtime-context/index.js +1 -1
  58. package/dist/style.css +1 -1
  59. package/dist/surfboard/index.js +2 -2
  60. package/dist/types/data-app-sdk/contracts.d.ts +0 -146
  61. package/dist/types/data-app-sdk/index.d.ts +0 -2
  62. package/dist/types/index.js +6 -6
  63. package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +1 -7
  64. package/package.json +1 -3
  65. package/src/data-app-sdk/README.md +7 -31
  66. package/dist/chunks/pivot-result-contract-expectations-fKBHFPfz.js +0 -56
  67. package/dist/chunks/raw-temporal-contract-CjHaUIsE.js +0 -64
  68. package/dist/chunks/report-preferences-dialog-D_wrbIQt.js +0 -2261
  69. package/dist/chunks/selection-reducer-By4CSmEF.js +0 -111
  70. package/dist/chunks/temporal-bucket-DzyadxVY.js +0 -2071
  71. package/dist/chunks/temporal-input-presentation-CJWS4d0L.js +0 -879
  72. package/dist/chunks/x-4f5U2XwU.js +0 -100
  73. package/dist/chunks/zoned-wall-clock-MulfA26h.js +0 -129
  74. package/dist/types/data-app-sdk/devtools/index.d.ts +0 -49
  75. package/dist/types/data-app-sdk/devtools.d.ts +0 -1
@@ -1,5 +1,5 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-D_wrbIQt.js";
2
- import { C as f, E as D } from "../chunks/table-settings-PpINOzw8.js";
1
+ import { a, R as s, D as o } from "../chunks/report-preferences-dialog-CFg5VFLk.js";
2
+ import { C as f, E as D } from "../chunks/table-settings-DF1gdVQR.js";
3
3
  export {
4
4
  f as CONTROL_CARD_DEFAULT_VALUE,
5
5
  a as DisplayFormatPreferencesFields,
@@ -238,40 +238,13 @@ export type SemaphorDataAppDefinition = {
238
238
  queries?: Record<string, SemaphorQueryDefinition>;
239
239
  views: SemaphorDataAppViewDefinition[];
240
240
  };
241
- export type SemaphorDataAppDevtoolsUiConfig = {
242
- buttonPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative';
243
- initialIsOpen?: boolean;
244
- panelPosition?: 'bottom' | 'right';
245
- };
246
241
  export type SemaphorDataAppDebugConfig = boolean | {
247
242
  enabled?: boolean;
248
- exposeWindowBridge?: boolean;
249
- autoRenderDevtools?: boolean | SemaphorDataAppDevtoolsUiConfig;
250
243
  requestServerDebug?: boolean;
251
- maxQueries?: number;
252
- maxEventsPerQuery?: number;
253
- };
254
- export type SemaphorDataAppSourceHint = {
255
- file?: string;
256
- line?: number;
257
- column?: number;
258
- exportName?: string;
259
- component?: string;
260
- note?: string;
261
- };
262
- export type SemaphorQueryDebugOptions = {
263
- viewId?: string;
264
- viewTitle?: string;
265
- visualType?: string;
266
- sectionTitle?: string;
267
- title?: string;
268
- sourceHint?: SemaphorDataAppSourceHint;
269
- sourceHints?: SemaphorDataAppSourceHint[];
270
244
  };
271
245
  export type SemaphorQueryRuntimeOptions = {
272
246
  inputs?: SemaphorInputReference[];
273
247
  selections?: SemaphorSelectionReference[];
274
- debug?: SemaphorQueryDebugOptions;
275
248
  };
276
249
  export type SemaphorQueryStatus = 'idle' | 'loading' | 'success' | 'error';
277
250
  export type SemaphorDataAppQueryError = Error & {
@@ -282,124 +255,6 @@ export type SemaphorDataAppQueryError = Error & {
282
255
  validation?: SemaphorAnalyticsValidationResult;
283
256
  validationIssues?: SemaphorAnalyticsValidationIssue[];
284
257
  };
285
- export type SemaphorDataAppTraceEvent = {
286
- type: 'query_started';
287
- queryId: string;
288
- requestId?: string;
289
- at: string;
290
- } | {
291
- type: 'query_succeeded';
292
- queryId: string;
293
- requestId?: string;
294
- at: string;
295
- rowCount?: number;
296
- durationMs?: number;
297
- } | {
298
- type: 'query_failed';
299
- queryId: string;
300
- requestId?: string;
301
- at: string;
302
- errorMessage: string;
303
- } | {
304
- type: 'query_ignored_stale';
305
- queryId: string;
306
- requestId?: string;
307
- at: string;
308
- reason: 'newer_inputs' | 'unmounted' | 'superseded';
309
- } | {
310
- type: 'input_changed';
311
- inputId: string;
312
- at: string;
313
- valuePreview?: string;
314
- };
315
- export type SemaphorDataAppTrace = {
316
- traceId: string;
317
- viewId?: string;
318
- viewTitle?: string;
319
- visualType?: string;
320
- sectionTitle?: string;
321
- queryId: string;
322
- queryLabel?: string;
323
- queryKind: SemaphorQueryDefinition['queryKind'];
324
- builder: 'semaphor.metric' | 'semaphor.records' | 'semaphor.matrix' | 'semaphor.analysis' | 'semaphor.inputOptions' | 'semaphor.sql';
325
- sourceRefs: SemaphorSourceRef[];
326
- sourceHints?: SemaphorDataAppSourceHint[];
327
- projectionFieldRefs?: SemaphorFieldRef[];
328
- inputFieldRefs?: SemaphorFieldRef[];
329
- fieldRefs: SemaphorFieldRef[];
330
- inputsApplied: Array<{
331
- inputId: string;
332
- inputLabel?: string;
333
- fieldRef?: SemaphorFieldRef;
334
- operator?: string;
335
- valuePreview?: string;
336
- }>;
337
- latestAttempt?: {
338
- requestId?: string;
339
- status: SemaphorQueryStatus;
340
- durationMs?: number;
341
- rowCount?: number;
342
- columnCount?: number;
343
- cacheStatus?: 'hit' | 'miss' | 'unknown';
344
- metricCoverage?: {
345
- populatedMetricKeys?: string[];
346
- missingMeasures?: string[];
347
- };
348
- resultPreview?: SemaphorDataAppResultPreview;
349
- executionResult?: SemaphorAnalyticsExecutionResult;
350
- errorMessage?: string;
351
- };
352
- recentEvents: SemaphorDataAppTraceEvent[];
353
- server?: {
354
- compiledSql?: string;
355
- dialect?: string;
356
- sqlHash?: string;
357
- executionPlanSummary?: string;
358
- };
359
- clientWarnings: string[];
360
- };
361
- export type SemaphorDataAppResultPreviewColumn = {
362
- key: string;
363
- label: string;
364
- };
365
- export type SemaphorDataAppResultPreview = {
366
- title: string;
367
- summary: string;
368
- columns: SemaphorDataAppResultPreviewColumn[];
369
- rows: Array<Record<string, unknown>>;
370
- truncatedRows: boolean;
371
- truncatedColumns: boolean;
372
- };
373
- export type SemaphorDataAppDevtoolsIssue = {
374
- traceId: string;
375
- queryId: string;
376
- viewId?: string;
377
- viewTitle?: string;
378
- queryLabel?: string;
379
- severity: 'error' | 'warning';
380
- title: string;
381
- message: string;
382
- code?: string;
383
- path?: string;
384
- };
385
- export type SemaphorDataAppDevtoolsState = {
386
- enabled: boolean;
387
- queries: SemaphorDataAppTrace[];
388
- issues: SemaphorDataAppDevtoolsIssue[];
389
- getQuery(queryId: string): SemaphorDataAppTrace | undefined;
390
- getQueries(queryId: string): SemaphorDataAppTrace[];
391
- };
392
- export type SemaphorDataAppDevtoolsWindowBridge = {
393
- snapshot(): SemaphorDataAppDevtoolsState;
394
- getQuery(queryId: string): SemaphorDataAppTrace | undefined;
395
- getQueries(queryId: string): SemaphorDataAppTrace[];
396
- getIssues(): SemaphorDataAppDevtoolsIssue[];
397
- };
398
- declare global {
399
- interface Window {
400
- __SEMAPHOR_DEVTOOLS__?: SemaphorDataAppDevtoolsWindowBridge;
401
- }
402
- }
403
258
  export type SemaphorQueryState = {
404
259
  status: SemaphorQueryStatus;
405
260
  executionStatus?: SemaphorAnalyticsExecutionStatus;
@@ -414,7 +269,6 @@ export type SemaphorQueryState = {
414
269
  isStale: boolean;
415
270
  isValidated: boolean;
416
271
  error: SemaphorDataAppQueryError | null;
417
- trace?: SemaphorDataAppTrace;
418
272
  };
419
273
  export type SemaphorMetricPayload = {
420
274
  primaryValue: number | string | null;
@@ -1,6 +1,4 @@
1
1
  export { defineSemaphorDataApp, defineSemaphorInput, semaphor, } from './builders.js';
2
- export { SemaphorDevtools, SemaphorDevtoolsInspectButton, SemaphorViewBoundary, useSemaphorDevtools, } from './devtools.js';
3
- export type { SemaphorDevtoolsInspectButtonProps, SemaphorDevtoolsProps, } from './devtools.js';
4
2
  export { createSemaphorQueryExecutor } from './executor.js';
5
3
  export { semaphorMetricAggregate, semaphorMetricMeasureBindingKey, } from '../shared/analytics-protocol/index.js';
6
4
  export { isSemaphorInputValueValidForOptions, useClearInvalidSemaphorInputValue, useSemaphorInput, useSemaphorInputs, useSemaphorQuery, } from './hooks.js';
@@ -1,9 +1,9 @@
1
- import { C as s, E as r, V as l, i as o, c as i, g as n, f as d, b as m, e as u, d as c, a as E, u as p, s as C, h as T, j as D, q as A, o as I, m as _, n as F, p as S, k as b, l as L, r as f, t as N } from "../chunks/table-settings-PpINOzw8.js";
2
- import { C as y, D as g, L as h, e as x, g as M, j as O, h as V, k, d as w, b as U, i as B, c as K, n as z, f as v } from "../chunks/validators-CZo_H4E6.js";
3
- import { D as q } from "../chunks/token-types--0bgRCaO.js";
4
- import { B as P, a as Q, p as j, r as W } from "../chunks/bookmark-state-7iZErWnR.js";
5
- import { r as X, a as H } from "../chunks/pivot-result-identity-CWi5WrrY.js";
6
- import { D as $ } from "../chunks/report-runtime-context-BgM-iNWB.js";
1
+ import { C as s, E as r, V as l, i as o, c as i, g as n, f as d, b as m, e as u, d as c, a as E, u as p, s as C, h as T, j as D, q as A, o as I, m as _, n as F, p as S, k as b, l as L, r as f, t as N } from "../chunks/table-settings-DF1gdVQR.js";
2
+ import { C as y, D as g, L as h, e as x, g as M, j as O, h as V, k, d as w, b as U, i as B, c as K, n as z, f as v } from "../chunks/validators-hmfNNQz8.js";
3
+ import { D as q } from "../chunks/token-types-DFyLflLY.js";
4
+ import { B as P, a as Q, p as j, r as W } from "../chunks/bookmark-state-PjQpxbG7.js";
5
+ import { r as X, a as H } from "../chunks/pivot-result-identity-CrQ54Xbj.js";
6
+ import { D as $ } from "../chunks/report-runtime-context-CohdtiMg.js";
7
7
  const e = [
8
8
  "concatenate",
9
9
  "conditional-category",
@@ -1,5 +1,5 @@
1
1
  import { TFilter } from '../../../components/surfboard/filter/types.js';
2
- import { NormalizedFilterDashboardInput, TDashboard } from '../../../lib/types/common-types.js';
2
+ import { TDashboard } from '../../../lib/types/common-types.js';
3
3
  import { FilterInputEntry } from './read-dashboard-filter-model.js';
4
4
  /** One definition per filter input, in model order. The same array for the same dashboard object. */
5
5
  export declare function listDashboardFilterDefinitions(dashboard: TDashboard): readonly TFilter[];
@@ -11,12 +11,6 @@ export declare function getDashboardGlobalDateFilter(dashboard: TDashboard): TFi
11
11
  * own kind. None for an unknown tab.
12
12
  */
13
13
  export declare function listDashboardFilterInputsOnTab(dashboard: TDashboard, sheetId: string | null | undefined, sheetKind?: 'dashboard' | 'document'): readonly FilterInputEntry[];
14
- /**
15
- * A filter hidden from the toolbar and not attached to a visual: a toolbar
16
- * filter's `hide`, or an input placed `hidden` (OF-D14). The edit-mode strip
17
- * of hidden filters lists these.
18
- */
19
- export declare function isHiddenFilterInput(input: NormalizedFilterDashboardInput): boolean;
20
14
  /**
21
15
  * Every filter definition the stored template holds, as stored: toolbar
22
16
  * filters, stored inputs' filters and prototype Document inputs' filters,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.556",
8
+ "version": "0.1.557",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -161,7 +161,6 @@
161
161
  "@dnd-kit/sortable": "^10.0.0",
162
162
  "@dnd-kit/utilities": "^3.2.2",
163
163
  "@floating-ui/react-dom": "^2.1.8",
164
- "@headlessui/react": "^2.2.0",
165
164
  "@lexical/history": "^0.43.0",
166
165
  "@lexical/link": "^0.43.0",
167
166
  "@lexical/list": "^0.43.0",
@@ -292,7 +291,6 @@
292
291
  "prettier-plugin-tailwindcss": "^0.6.1",
293
292
  "react": "19.3.0",
294
293
  "react-dom": "19.3.0",
295
- "react-grab": "^0.1.16",
296
294
  "rollup-plugin-visualizer": "^5.12.0",
297
295
  "simple-zustand-devtools": "^1.1.0",
298
296
  "tailwindcss": "^3.4.1",
@@ -12,7 +12,6 @@ Do not inspect SDK implementation internals to discover these patterns.
12
12
  ```tsx
13
13
  import {
14
14
  SemaphorDataAppProvider,
15
- SemaphorDevtools,
16
15
  semaphor,
17
16
  useClearInvalidSemaphorInputValue,
18
17
  useSemaphorInputs,
@@ -28,46 +27,24 @@ import type {
28
27
  } from "react-semaphor/data-app-sdk";
29
28
  ```
30
29
 
31
- ## Runtime Provider And DevTools
32
-
33
- Generated local/dev apps should mount one root DevTools instance and enable the
34
- debug bridge only outside production embeds.
30
+ ## Runtime Provider
35
31
 
36
32
  ```tsx
37
33
  const runtimeToken = import.meta.env.VITE_SEMAPHOR_PROJECT_TOKEN;
38
- const enableDevtools =
39
- import.meta.env.DEV ||
40
- (typeof window !== "undefined" && window.location.hostname === "localhost");
41
34
 
42
35
  export function Root() {
43
36
  return (
44
- <SemaphorDataAppProvider
45
- token={runtimeToken}
46
- debug={enableDevtools ? { exposeWindowBridge: true } : false}
47
- >
37
+ <SemaphorDataAppProvider token={runtimeToken} debug={import.meta.env.DEV}>
48
38
  <App />
49
- <SemaphorDevtools
50
- initialIsOpen={false}
51
- buttonPosition="bottom-right"
52
- panelPosition="right"
53
- />
54
39
  </SemaphorDataAppProvider>
55
40
  );
56
41
  }
57
42
  ```
58
43
 
59
- Add hook-level debug source hints when they are cheap and non-repetitive:
60
-
61
- ```tsx
62
- const result = useSemaphorQuery(revenueBySegment, {
63
- debug: {
64
- sourceHint: {
65
- file: "src/views/RevenueBySegment.tsx",
66
- component: "RevenueBySegment",
67
- },
68
- },
69
- });
70
- ```
44
+ With `debug` on, each query asks the server for debug detail. For an
45
+ organization user, the result's `executionResult.metadata.dataAppDebug` then
46
+ carries the request id, duration and compiled SQL. Keep it off in production
47
+ embeds.
71
48
 
72
49
  ## Query State
73
50
 
@@ -129,8 +106,7 @@ Important state fields:
129
106
 
130
107
  Validation failures produce a structured `SemaphorDataAppQueryError` in
131
108
  `result.error`, with `kind: "data_app_query_error"`, `validation`,
132
- `validationIssues`, and `executionResult` when available. DevTools traces expose
133
- the same execution status and structured issues.
109
+ `validationIssues`, and `executionResult` when available.
134
110
 
135
111
  ## Source And Fields
136
112
 
@@ -1,56 +0,0 @@
1
- var c = Object.defineProperty;
2
- var d = (r, e, t) => e in r ? c(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var l = (r, e, t) => d(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { G as u } from "./temporal-bucket-DzyadxVY.js";
5
- import "./validators-CZo_H4E6.js";
6
- import "./matrix-operation-contract-C1G6AJNh.js";
7
- import { r as v } from "./metric-comparison-BfcmwxM1.js";
8
- import "./analytics-base-schemas-BUFUoO6G.js";
9
- import "zod";
10
- class m extends Error {
11
- constructor(t, a) {
12
- super(`${t}: ${a}`);
13
- l(this, "deliveryBlocking", !0);
14
- this.code = t, this.name = "PivotHeaderPresentationError";
15
- }
16
- }
17
- function k(r) {
18
- var i;
19
- const e = r.mode ?? "formatted", t = r.members.map((o) => {
20
- var n;
21
- if (e === "canonical" || !o.temporalBucket)
22
- return o.value === null ? "" : String(o.value);
23
- const s = (n = r.resolveTemporalFormat) == null ? void 0 : n.call(r, o.fieldId);
24
- if (!s)
25
- throw new m(
26
- "missing_resolved_temporal_format",
27
- `Missing resolved temporal presentation for pivot field "${o.fieldId}"`
28
- );
29
- return u({
30
- value: o.value,
31
- metadata: o.temporalBucket,
32
- format: s
33
- });
34
- }), a = ((i = r.metricLabel) == null ? void 0 : i.trim()) || void 0;
35
- return {
36
- memberLabels: t,
37
- ...a ? { metricLabel: a } : {},
38
- flattenedLabel: [
39
- ...t,
40
- ...a ? [a] : []
41
- ].join(" / ")
42
- };
43
- }
44
- function B(r) {
45
- const e = /* @__PURE__ */ new Map();
46
- return r.forEach((t) => {
47
- t.id && e.set(t.id, (e.get(t.id) ?? 0) + 1);
48
- }), r.flatMap(
49
- (t) => t.id && (e.get(t.id) ?? 0) > 1 ? [v(t)] : []
50
- );
51
- }
52
- export {
53
- m as P,
54
- B as d,
55
- k as p
56
- };
@@ -1,64 +0,0 @@
1
- var d = Object.defineProperty;
2
- var i = (a, e, t) => e in a ? d(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
- var n = (a, e, t) => i(a, typeof e != "symbol" ? e + "" : e, t);
4
- import { R as l } from "./analytics-base-schemas-BUFUoO6G.js";
5
- class r extends Error {
6
- constructor(t) {
7
- super(t);
8
- n(this, "code");
9
- this.name = "RawTemporalMetadataContractError", this.code = l.invalidMetadata;
10
- }
11
- }
12
- function s(a) {
13
- if (a === null || typeof a != "object" || Array.isArray(a))
14
- return !1;
15
- const e = Object.getPrototypeOf(a);
16
- return e === null || e === Object.prototype;
17
- }
18
- function m(a) {
19
- if (!s(a))
20
- throw new r(
21
- "Raw temporal metadata must be an object."
22
- );
23
- const e = Object.keys(a);
24
- if (e.length !== 2 || !e.includes("kind") || !e.includes("valueKind"))
25
- throw new r(
26
- "Raw temporal metadata must contain only kind and valueKind."
27
- );
28
- if (a.kind !== "raw_temporal")
29
- throw new r(
30
- "Raw temporal metadata kind must be raw_temporal."
31
- );
32
- if (a.valueKind !== "date" && a.valueKind !== "wall_datetime" && a.valueKind !== "instant")
33
- throw new r(
34
- "Raw temporal valueKind must be date, wall_datetime, or instant."
35
- );
36
- return {
37
- kind: "raw_temporal",
38
- valueKind: a.valueKind
39
- };
40
- }
41
- function u(a, e) {
42
- if (!a.rawTemporal) {
43
- if (e.metadataRequired)
44
- throw new r(
45
- "Activated raw temporal result is missing metadata."
46
- );
47
- return;
48
- }
49
- if (a.temporalBucket)
50
- throw new r(
51
- "A result column cannot carry both raw and grouped temporal metadata."
52
- );
53
- const t = m(a.rawTemporal), o = t.valueKind === "date" ? "date" : "datetime";
54
- if (a.dataType !== o)
55
- throw new r(
56
- `${t.valueKind} raw temporal values require dataType ${o}.`
57
- );
58
- return t;
59
- }
60
- export {
61
- r as R,
62
- m as p,
63
- u as v
64
- };