react-semaphor 0.1.339 → 0.1.341
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.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +1 -1
- package/dist/chunks/{calendar-preferences-dialog-8-KE5sVX.js → calendar-preferences-dialog-_u4Xm011.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-2IbYrrP1.js → calendar-preferences-dialog-hS6POgEs.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CcqDPVke.js → dashboard-briefing-launcher-D18qNhwa.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DtxDRAiu.js → dashboard-briefing-launcher-DHzIiaKF.js} +3 -3
- package/dist/chunks/{dashboard-controls-By7aKmDj.js → dashboard-controls-CilLVS_Q.js} +1 -1
- package/dist/chunks/{dashboard-controls-Bi98DhYD.js → dashboard-controls-g1OcteYf.js} +3 -3
- package/dist/chunks/{dashboard-json-CGxIsTEP.js → dashboard-json-BjnGSaxC.js} +1 -1
- package/dist/chunks/{dashboard-json-BOyLuhS6.js → dashboard-json-ClH0kTga.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BuXlHmJH.js → edit-dashboard-visual-C_3NYnPz.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-Ba8LenNc.js → edit-dashboard-visual-DbVMVMKM.js} +3 -3
- package/dist/chunks/{index-DT9osgRT.js → index-BNZjkxPH.js} +3 -3
- package/dist/chunks/{index-DVPvpd8u.js → index-CuSvSh86.js} +7 -6
- package/dist/chunks/{resource-management-panel-98Hy6SYB.js → resource-management-panel-DxjN2uw4.js} +2 -2
- package/dist/chunks/{resource-management-panel-ByR-FD3h.js → resource-management-panel-N5iUOE89.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-uNxArZdj.js → use-create-flow-overlay-state-CSjc7cXZ.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-D5uvjbwY.js → use-create-flow-overlay-state-CXPnnXh1.js} +2 -2
- package/dist/chunks/{use-visual-utils-CpaqIHoc.js → use-visual-utils-C3MRLrHu.js} +1 -1
- package/dist/chunks/{use-visual-utils-BLh9mKic.js → use-visual-utils-DsoGoqPF.js} +1 -1
- package/dist/chunks/validators-Caj7EMd1.js +1 -0
- package/dist/chunks/{validators-CPEQojnV.js → validators-YtnkRA1G.js} +66 -43
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +1 -1
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +120 -113
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +13 -2
- package/dist/types/dashboard-authoring.d.ts +4 -0
- package/dist/types/dashboard.d.ts +2 -0
- package/dist/types/data-app-builder.d.ts +3 -0
- package/dist/types/data-app-sdk.d.ts +3 -0
- package/dist/types/main.d.ts +5 -0
- package/dist/types/shared.d.ts +1 -0
- package/dist/types/surfboard.d.ts +2 -0
- package/dist/types/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunks/validators-CfP-49k9.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { E as T, F as N, S, q as P, U as _, r as w, s as F, t as x, v as R, w as I, C as M, i as L, I as k, x as U, j as O, k as z, l as V, m as H } from "./chunks/index-
|
|
2
|
-
import { W as ca, D as fa, T as ma, Q as pa, N as ha, a9 as ga, A as Ca, H as Da, H as Ea, J as xa, V as Ta, a as ba, a8 as ya, a4 as va, P as Aa, O as Ba, ac as Na, a7 as Sa, a6 as Pa, a5 as _a, ab as wa, aa as Fa, a1 as Ra, _ as Ia, M as Ma, Y as La, L as ka, z as Ua, X as Oa, Z as za, B as Va, a3 as Ha, a0 as qa, $ as Wa, a2 as ja, y as Ga, K as Qa, G as Ka } from "./chunks/index-
|
|
1
|
+
import { E as T, F as N, S, q as P, U as _, r as w, s as F, t as x, v as R, w as I, C as M, i as L, I as k, x as U, j as O, k as z, l as V, m as H } from "./chunks/index-CuSvSh86.js";
|
|
2
|
+
import { W as ca, D as fa, T as ma, Q as pa, N as ha, a9 as ga, A as Ca, H as Da, H as Ea, J as xa, V as Ta, a as ba, a8 as ya, a4 as va, P as Aa, O as Ba, ac as Na, a7 as Sa, a6 as Pa, a5 as _a, ab as wa, aa as Fa, a1 as Ra, _ as Ia, M as Ma, Y as La, L as ka, z as Ua, X as Oa, Z as za, B as Va, a3 as Ha, a0 as qa, $ as Wa, a2 as ja, y as Ga, K as Qa, G as Ka } from "./chunks/index-CuSvSh86.js";
|
|
3
3
|
import { a as Ya, C as $a, D as Ja, E as Za, P as ae, g as ee, d as se, h as re, b as oe, c as te, i as ne } from "./chunks/common-types-4bjoIgvm.js";
|
|
4
|
-
import { C as le } from "./chunks/calendar-preferences-dialog-
|
|
4
|
+
import { C as le } from "./chunks/calendar-preferences-dialog-hS6POgEs.js";
|
|
5
5
|
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
6
6
|
import { u as q, P as W, b as j, B as G, a as C, g as Q, d as K, e as X } from "./chunks/switch-CP7SmEIZ.js";
|
|
7
7
|
import { F as ue, q as ce, h as fe, i as me, k as pe, s as he, r as ge, w as Ce, x as De, p as Ee, j as xe, o as Te, t as be, n as ye, m as ve, l as Ae, y as Be, v as Ne, z as Se, D as Pe, A as _e, E as we, H as Fe, G as Re } from "./chunks/switch-CP7SmEIZ.js";
|
|
8
8
|
import * as m from "react";
|
|
9
9
|
import { useMemo as Y, useEffect as b } from "react";
|
|
10
|
-
import { ResourceManagementPanel as Me } from "./chunks/resource-management-panel-
|
|
10
|
+
import { ResourceManagementPanel as Me } from "./chunks/resource-management-panel-DxjN2uw4.js";
|
|
11
11
|
import { DEFAULT_CALENDAR_CONTEXT as ke, DEFAULT_SEMANTIC_DOMAIN_ACCESS as Ue } from "./types/index.js";
|
|
12
12
|
import { u as ze } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
|
|
13
13
|
import "react-dom";
|
|
14
14
|
import "./chunks/index-CJdxSyQq.js";
|
|
15
|
-
import { A as He, J as qe, B as We, K as je, D as Ge, d as Qe, e as Ke, c as Xe, a as Ye, E as $e, N as Je, U as Ze, V as as, W as es, C as ss, G as rs, H as os, F as ts, t as ns, h as is, z as ls, j as ds, v as us, g as cs, w as fs, x as ms, o as ps, s as hs, q as gs, f as Cs, l as Ds, p as Es, y as xs, m as Ts, r as bs, k as ys, n as vs, i as As, u as Bs, b as Ns, I as Ss } from "./chunks/dashboard-briefing-launcher-
|
|
15
|
+
import { A as He, J as qe, B as We, K as je, D as Ge, d as Qe, e as Ke, c as Xe, a as Ye, E as $e, N as Je, U as Ze, V as as, W as es, C as ss, G as rs, H as os, F as ts, t as ns, h as is, z as ls, j as ds, v as us, g as cs, w as fs, x as ms, o as ps, s as hs, q as gs, f as Cs, l as Ds, p as Es, y as xs, m as Ts, r as bs, k as ys, n as vs, i as As, u as Bs, b as Ns, I as Ss } from "./chunks/dashboard-briefing-launcher-DHzIiaKF.js";
|
|
16
16
|
import { n as _s, s as ws } from "./chunks/normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
17
17
|
import "./chunks/index-CuHybtft.js";
|
|
18
18
|
function ta(e) {
|
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-BNZjkxPH.js"),e=require("../chunks/common-types-C73-Ud1-.js"),a=require("../chunks/calendar-preferences-dialog-_u4Xm011.js");exports.Surfboard=r.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=a.CalendarPreferencesDialog;
|
package/dist/surfboard/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e } from "../chunks/index-
|
|
1
|
+
import { a as e } from "../chunks/index-CuSvSh86.js";
|
|
2
2
|
import { C, E } from "../chunks/common-types-4bjoIgvm.js";
|
|
3
|
-
import { C as s } from "../chunks/calendar-preferences-dialog-
|
|
3
|
+
import { C as s } from "../chunks/calendar-preferences-dialog-hS6POgEs.js";
|
|
4
4
|
export {
|
|
5
5
|
C as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
s as CalendarPreferencesDialog,
|
|
@@ -294,6 +294,8 @@ export declare const SEMAPHOR_ANALYTICS_INTENT_FIXTURES: {
|
|
|
294
294
|
};
|
|
295
295
|
};
|
|
296
296
|
|
|
297
|
+
export declare type SemaphorAggregateFunction = 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
|
|
298
|
+
|
|
297
299
|
export declare type SemaphorAnalyticsExecutionResult = {
|
|
298
300
|
intentId?: string;
|
|
299
301
|
queryId?: string;
|
|
@@ -301,7 +303,7 @@ export declare type SemaphorAnalyticsExecutionResult = {
|
|
|
301
303
|
resultShape?: SemaphorAnalyticsResult['kind'] | 'period_change';
|
|
302
304
|
intent?: SemaphorAnalyticsIntent;
|
|
303
305
|
compiledQuery?: SemaphorCompiledQuery;
|
|
304
|
-
fieldsUsed?:
|
|
306
|
+
fieldsUsed?: SemaphorExecutionFieldRef[];
|
|
305
307
|
result?: SemaphorAnalyticsResult;
|
|
306
308
|
validation: SemaphorAnalyticsValidationResult;
|
|
307
309
|
coverage?: {
|
|
@@ -485,6 +487,12 @@ export declare type SemaphorDashboardViewIntent = {
|
|
|
485
487
|
|
|
486
488
|
export declare type SemaphorDialect = 'postgres' | 'mysql' | 'mssql' | 'snowflake' | 'clickhouse' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
|
|
487
489
|
|
|
490
|
+
export declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
|
|
491
|
+
semanticAggregate?: SemaphorAggregateFunction;
|
|
492
|
+
effectiveAggregate?: SemaphorAggregateFunction;
|
|
493
|
+
aggregateSource?: SemaphorMetricAggregateSource;
|
|
494
|
+
};
|
|
495
|
+
|
|
488
496
|
export declare type SemaphorExperienceIntent = SemaphorDashboardIntent;
|
|
489
497
|
|
|
490
498
|
export declare type SemaphorFieldRef = {
|
|
@@ -493,6 +501,7 @@ export declare type SemaphorFieldRef = {
|
|
|
493
501
|
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
494
502
|
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
495
503
|
source?: SemaphorSourceRef;
|
|
504
|
+
aggregate?: SemaphorAggregateFunction;
|
|
496
505
|
};
|
|
497
506
|
|
|
498
507
|
export declare function semaphorFieldRefsMatch(left: SemaphorFieldRef, right: SemaphorFieldRef): boolean;
|
|
@@ -547,6 +556,8 @@ export declare type SemaphorInputSpec = {
|
|
|
547
556
|
scope?: SemaphorInputScope;
|
|
548
557
|
};
|
|
549
558
|
|
|
559
|
+
export declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
|
|
560
|
+
|
|
550
561
|
export declare type SemaphorMetricAnalysis = {
|
|
551
562
|
kind: 'period_change';
|
|
552
563
|
orderBy?: 'absolute_change' | 'positive_change' | 'negative_change';
|
|
@@ -646,7 +657,7 @@ export declare type SemaphorRecordsResult = SemaphorAnalyticsResultBase & {
|
|
|
646
657
|
};
|
|
647
658
|
|
|
648
659
|
export declare type SemaphorRecoveryToolCall = {
|
|
649
|
-
name: 'semaphor_get_dataset_schema' | '
|
|
660
|
+
name: 'semaphor_get_dataset_schema' | 'semaphor_analyze' | 'semaphor_query_sql_advanced' | string;
|
|
650
661
|
arguments: Record<string, unknown>;
|
|
651
662
|
purpose: string;
|
|
652
663
|
obligationId?: string;
|
|
@@ -1252,6 +1252,7 @@ declare interface Field {
|
|
|
1252
1252
|
expression?: string;
|
|
1253
1253
|
calculatedFormula?: CalculatedFieldFormula;
|
|
1254
1254
|
format?: FormatSpec;
|
|
1255
|
+
aggregate?: AggregateFunction;
|
|
1255
1256
|
fieldScope?: FieldScope;
|
|
1256
1257
|
}
|
|
1257
1258
|
|
|
@@ -1801,6 +1802,8 @@ declare type SelectedEntities = SelectedEntity[];
|
|
|
1801
1802
|
|
|
1802
1803
|
declare type SelectedEntity = DatabaseEntityReference | DataModelEntityReference | DatasetEntityReference | FileEntityReference;
|
|
1803
1804
|
|
|
1805
|
+
declare type SemaphorAggregateFunction = 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
|
|
1806
|
+
|
|
1804
1807
|
declare type SemaphorAnalyticsFilter = SemaphorAnalyticsValueFilter | SemaphorAnalyticsNullFilter;
|
|
1805
1808
|
|
|
1806
1809
|
declare type SemaphorAnalyticsFilterBase = {
|
|
@@ -1859,6 +1862,7 @@ declare type SemaphorFieldRef = {
|
|
|
1859
1862
|
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
1860
1863
|
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
1861
1864
|
source?: SemaphorSourceRef;
|
|
1865
|
+
aggregate?: SemaphorAggregateFunction;
|
|
1862
1866
|
};
|
|
1863
1867
|
|
|
1864
1868
|
declare type SemaphorInputBinding = {
|
|
@@ -1289,6 +1289,7 @@ declare interface Field {
|
|
|
1289
1289
|
expression?: string;
|
|
1290
1290
|
calculatedFormula?: CalculatedFieldFormula;
|
|
1291
1291
|
format?: FormatSpec;
|
|
1292
|
+
aggregate?: AggregateFunction;
|
|
1292
1293
|
fieldScope?: FieldScope;
|
|
1293
1294
|
}
|
|
1294
1295
|
|
|
@@ -2566,6 +2567,7 @@ export declare type TDataColumn = {
|
|
|
2566
2567
|
calculatedFormula?: CalculatedFieldFormula;
|
|
2567
2568
|
format?: FormatSpec;
|
|
2568
2569
|
sourceField?: string;
|
|
2570
|
+
aggregate?: AggregateFunction;
|
|
2569
2571
|
};
|
|
2570
2572
|
|
|
2571
2573
|
export declare type TDataLabelsConfig = {
|
|
@@ -480,6 +480,8 @@ export declare type GeneratedRevision = {
|
|
|
480
480
|
|
|
481
481
|
export declare type ReasoningEffort = 'low' | 'medium' | 'high';
|
|
482
482
|
|
|
483
|
+
declare type SemaphorAggregateFunction = 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
|
|
484
|
+
|
|
483
485
|
declare type SemaphorAnalyticsFilter = SemaphorAnalyticsValueFilter | SemaphorAnalyticsNullFilter;
|
|
484
486
|
|
|
485
487
|
declare type SemaphorAnalyticsFilterBase = {
|
|
@@ -513,6 +515,7 @@ declare type SemaphorFieldRef = {
|
|
|
513
515
|
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
514
516
|
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
515
517
|
source?: SemaphorSourceRef;
|
|
518
|
+
aggregate?: SemaphorAggregateFunction;
|
|
516
519
|
};
|
|
517
520
|
|
|
518
521
|
declare type SemaphorInputBinding = {
|
|
@@ -16,6 +16,8 @@ export declare function normalizeSemaphorInputOptions(options?: Array<{
|
|
|
16
16
|
|
|
17
17
|
export declare function readWindowRuntime(): SemaphorDataAppWindowRuntime | undefined;
|
|
18
18
|
|
|
19
|
+
declare type SemaphorAggregateFunction = 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
|
|
20
|
+
|
|
19
21
|
declare type SemaphorAnalyticsFilter = SemaphorAnalyticsValueFilter | SemaphorAnalyticsNullFilter;
|
|
20
22
|
|
|
21
23
|
declare type SemaphorAnalyticsFilterBase = {
|
|
@@ -255,6 +257,7 @@ declare type SemaphorFieldRef = {
|
|
|
255
257
|
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
256
258
|
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
257
259
|
source?: SemaphorSourceRef;
|
|
260
|
+
aggregate?: SemaphorAggregateFunction;
|
|
258
261
|
};
|
|
259
262
|
|
|
260
263
|
declare type SemaphorInputBinding = {
|
package/dist/types/main.d.ts
CHANGED
|
@@ -3258,6 +3258,7 @@ export declare interface Field {
|
|
|
3258
3258
|
expression?: string;
|
|
3259
3259
|
calculatedFormula?: CalculatedFieldFormula;
|
|
3260
3260
|
format?: FormatSpec;
|
|
3261
|
+
aggregate?: AggregateFunction;
|
|
3261
3262
|
fieldScope?: FieldScope;
|
|
3262
3263
|
}
|
|
3263
3264
|
|
|
@@ -4393,6 +4394,8 @@ declare type SemanticExecutionPayload = {
|
|
|
4393
4394
|
}>;
|
|
4394
4395
|
};
|
|
4395
4396
|
|
|
4397
|
+
declare type SemaphorAggregateFunction = 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
|
|
4398
|
+
|
|
4396
4399
|
declare type SemaphorAnalyticsFilter = SemaphorAnalyticsValueFilter | SemaphorAnalyticsNullFilter;
|
|
4397
4400
|
|
|
4398
4401
|
declare type SemaphorAnalyticsFilterBase = {
|
|
@@ -4431,6 +4434,7 @@ declare type SemaphorFieldRef = {
|
|
|
4431
4434
|
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
4432
4435
|
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
4433
4436
|
source?: SemaphorSourceRef;
|
|
4437
|
+
aggregate?: SemaphorAggregateFunction;
|
|
4434
4438
|
};
|
|
4435
4439
|
|
|
4436
4440
|
declare type SemaphorInputBinding = {
|
|
@@ -5346,6 +5350,7 @@ export declare type TDataColumn = {
|
|
|
5346
5350
|
calculatedFormula?: CalculatedFieldFormula;
|
|
5347
5351
|
format?: FormatSpec;
|
|
5348
5352
|
sourceField?: string;
|
|
5353
|
+
aggregate?: AggregateFunction;
|
|
5349
5354
|
};
|
|
5350
5355
|
|
|
5351
5356
|
export declare type TDataLabelsConfig = {
|
package/dist/types/shared.d.ts
CHANGED
|
@@ -1299,6 +1299,7 @@ declare interface Field {
|
|
|
1299
1299
|
expression?: string;
|
|
1300
1300
|
calculatedFormula?: CalculatedFieldFormula;
|
|
1301
1301
|
format?: FormatSpec;
|
|
1302
|
+
aggregate?: AggregateFunction;
|
|
1302
1303
|
fieldScope?: FieldScope;
|
|
1303
1304
|
}
|
|
1304
1305
|
|
|
@@ -2578,6 +2579,7 @@ export declare type TDataColumn = {
|
|
|
2578
2579
|
calculatedFormula?: CalculatedFieldFormula;
|
|
2579
2580
|
format?: FormatSpec;
|
|
2580
2581
|
sourceField?: string;
|
|
2582
|
+
aggregate?: AggregateFunction;
|
|
2581
2583
|
};
|
|
2582
2584
|
|
|
2583
2585
|
export declare type TDataLabelsConfig = {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1847,6 +1847,7 @@ export declare interface Field {
|
|
|
1847
1847
|
expression?: string;
|
|
1848
1848
|
calculatedFormula?: CalculatedFieldFormula;
|
|
1849
1849
|
format?: FormatSpec;
|
|
1850
|
+
aggregate?: AggregateFunction;
|
|
1850
1851
|
fieldScope?: FieldScope;
|
|
1851
1852
|
}
|
|
1852
1853
|
|
|
@@ -3362,6 +3363,7 @@ export declare type TDataColumn = {
|
|
|
3362
3363
|
calculatedFormula?: CalculatedFieldFormula;
|
|
3363
3364
|
format?: FormatSpec;
|
|
3364
3365
|
sourceField?: string;
|
|
3366
|
+
aggregate?: AggregateFunction;
|
|
3365
3367
|
};
|
|
3366
3368
|
|
|
3367
3369
|
export declare type TDataLabelsConfig = {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function _(e){return e?e.kind==="semantic"?[e.kind,e.domainId,e.datasetId||"",e.datasetName].join(":"):e.kind==="physical"?[e.kind,e.connectionId,e.databaseName||"",e.schemaName||"",e.tableName].join(":"):[e.kind,e.connectionId,e.dialect||"",e.label||""].join(":"):""}function b(e,i){return!e||!i?e===i:e.kind!==i.kind?!1:e.kind==="semantic"&&i.kind==="semantic"?e.domainId!==i.domainId?!1:e.datasetId&&i.datasetId?e.datasetId===i.datasetId:e.datasetName===i.datasetName:_(e)===_(i)}function g(e,i){return e.kind!=="semantic"||i.kind!=="semantic"?e:{...e,datasetId:e.datasetId||i.datasetId,label:e.label||i.label,connectionId:e.connectionId||i.connectionId}}function k(e,i){return e.name===i.name&&b(e.source,i.source)}function R(e,i){return{...e,label:e.label||i.label,role:e.role||i.role,dataType:e.dataType||i.dataType,source:e.source&&i.source?g(e.source,i.source):e.source||i.source}}function n(e,i,a){return a?{code:e,message:i,path:a}:{code:e,message:i}}function N(e){for(let i=0;i<e.length;i+=1){const a=e[i];if(e.some((r,o)=>o!==i&&y(r,a)))return!1}return!0}function y(e,i){return k(e,i)}function j(e,i){const a=i.filter(r=>r.name===e.name);return e.source?a.some(r=>y(r,e)):a.length===1}function d(e){return typeof e=="string"&&e.trim().length>0}function u(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function v(e){const i=new Set;for(const a of e){if(i.has(a))return a;i.add(a)}return null}function w(e,i,a){if(!e||typeof e!="object"){a.push(n("missing_source","Analytics intent needs a source.",i));return}if(e.kind==="semantic"){d(e.domainId)||a.push(n("missing_semantic_domain","Semantic source needs a domainId.",`${i}.domainId`)),d(e.datasetName)||a.push(n("missing_dataset_name","Semantic source needs a datasetName.",`${i}.datasetName`));return}if(e.kind==="physical"){d(e.connectionId)||a.push(n("missing_connection_id","Physical source needs a connectionId.",`${i}.connectionId`)),d(e.tableName)||a.push(n("missing_table_name","Physical source needs a tableName.",`${i}.tableName`));return}if(e.kind==="sql"){d(e.connectionId)||a.push(n("missing_connection_id","SQL source needs a connectionId.",`${i}.connectionId`));return}a.push(n("invalid_source_kind","Source kind is not supported.",i))}function f(e,i,a,r={}){if(!e||!u(e)){r.required&&a.push(n("missing_field_ref","Field reference needs a name.",i));return}d(e.name)||a.push(n("missing_field_ref","Field reference needs a name.",`${i}.name`)),e.source!==void 0&&w(e.source,`${i}.source`,a)}function q(e,i){if(e.analysis===void 0)return;if(!u(e.analysis)){i.push(n("invalid_metric_analysis","Metric analysis must be a structured object.","analysis"));return}if(e.analysis.kind!=="period_change"){i.push(n("invalid_metric_analysis","Metric analysis kind is not supported.","analysis.kind"));return}e.dateField||i.push(n("missing_analysis_date_field","Period-change analysis needs a dateField.","dateField")),e.timeGrain||i.push(n("missing_analysis_time_grain","Period-change analysis needs a timeGrain.","timeGrain"));const{timeWindow:a}=e.analysis;a!==void 0&&A(a,"analysis.timeWindow",i)}function A(e,i,a){if(!u(e)){a.push(n("invalid_time_window","Time window must be a structured object.",i));return}e.unit!=="second"&&e.unit!=="minute"&&e.unit!=="hour"&&e.unit!=="day"&&e.unit!=="week"&&e.unit!=="month"&&e.unit!=="quarter"&&e.unit!=="year"&&a.push(n("invalid_time_window","Time window unit must be second, minute, hour, day, week, month, quarter, or year.",`${i}.unit`)),(typeof e.value!="number"||!Number.isFinite(e.value)||e.value<=0)&&a.push(n("invalid_time_window","Time window value must be a positive number.",`${i}.value`)),e.anchor!==void 0&&e.anchor!=="now"&&e.anchor!=="latest_available"&&a.push(n("invalid_time_window","Time window anchor must be now or latest_available.",`${i}.anchor`))}function x(e,i,a){if(e!==void 0){if(!Array.isArray(e)){a.push(n("invalid_analytics_filters","Analytics filters must be an array.",i));return}e.forEach((r,o)=>{const s=`${i}.${o}`;if(!u(r)){a.push(n("invalid_analytics_filter","Analytics filter must be a structured object.",s));return}const t=r;f(t.field,`${s}.field`,a,{required:!0});const p=t.operator==="is_null"||t.operator==="is_not_null";if(t.operator!==void 0&&t.operator!=="="&&t.operator!=="!="&&t.operator!=="in"&&t.operator!=="not_in"&&t.operator!=="contains"&&t.operator!=="not_contains"&&t.operator!=="between"&&t.operator!=="not_between"&&t.operator!==">"&&t.operator!==">="&&t.operator!=="<"&&t.operator!=="<="&&t.operator!=="is_null"&&t.operator!=="is_not_null"&&a.push(n("invalid_analytics_filter_operator","Analytics filter operator is not supported.",`${s}.operator`)),t.values===void 0&&!p&&a.push(n("missing_analytics_filter_value","Analytics filter needs values unless it is a null check.",s)),p&&t.values!==void 0){a.push(n("invalid_analytics_filter_values","Null-check analytics filters must not include values.",`${s}.values`));return}t.values!==void 0&&!Array.isArray(t.values)&&a.push(n("invalid_analytics_filter_values","Analytics filter values must be an array when provided.",`${s}.values`))})}}function h(e){var r;const i=[],a=[];if(!e||typeof e!="object")return{ok:!1,errors:[n("invalid_analytics_intent","Analytics intent must be a structured object.")],warnings:a,repairHints:[{code:"invalid_analytics_intent",recommendedNextStep:"Send one structured analytics intent object with kind, source, and required fields."}]};if(e.version!==void 0&&e.version!==1&&i.push(n("invalid_version","Analytics intent version must be 1.","version")),w(e.source,"source",i),e.kind==="metric"){const o=Array.isArray(e.metrics)?e.metrics.filter(s=>u(s)&&d(s.name)):[];if(!Array.isArray(e.metrics)||e.metrics.length===0?i.push(n("missing_metric","Metric intent needs at least one metric.","metrics")):e.metrics.some(s=>!u(s)||!d(s.name))&&i.push(n("invalid_metric_list","Metric intent metrics must be an array of field references with names.","metrics")),o.forEach((s,t)=>{f(s,`metrics.${t}`,i,{required:!0})}),o.length>0&&!N(o)){const s=o.find((t,p)=>o.some((c,l)=>l!==p&&y(c,t)));s&&i.push(n("duplicate_metric",`Metric intent has duplicate metric "${s.name}".`,"metrics"))}u(e.primaryMetric)&&d(e.primaryMetric.name)&&e.primaryMetric.source===void 0&&o.filter(s=>{var t;return s.name===((t=e.primaryMetric)==null?void 0:t.name)}).length>1&&i.push(n("ambiguous_primary_metric","Metric intent primaryMetric needs a source when it names a duplicated metric.","primaryMetric")),e.primaryMetric!==void 0&&(f(e.primaryMetric,"primaryMetric",i,{required:!0}),u(e.primaryMetric)&&d(e.primaryMetric.name)&&o.length>0&&!j(e.primaryMetric,o)&&i.push(n("invalid_primary_metric","Metric intent primaryMetric must match one metric field reference.","primaryMetric"))),e.dimensions!==void 0&&!Array.isArray(e.dimensions)?i.push(n("invalid_metric_dimensions","Metric intent dimensions must be an array of field references.","dimensions")):Array.isArray(e.dimensions)&&e.dimensions.some(s=>!u(s)||!d(s.name))&&i.push(n("invalid_metric_dimensions","Metric intent dimensions must be an array of field references with names.","dimensions")),e.dateField!==void 0&&f(e.dateField,"dateField",i),e.timeWindow!==void 0&&(A(e.timeWindow,"timeWindow",i),e.dateField||i.push(n("missing_time_window_date_field","Metric timeWindow needs a dateField.","dateField"))),x(e.filters,"filters",i),Array.isArray(e.dimensions)&&e.dimensions.forEach((s,t)=>{f(s,`dimensions.${t}`,i)}),q(e,i)}else e.kind==="records"?(!Array.isArray(e.fields)||e.fields.length===0?i.push(n("missing_record_fields","Records intent needs at least one field.","fields")):e.fields.some(o=>!u(o)||!d(o.name))&&i.push(n("invalid_record_fields","Records intent fields must be field references with names.","fields")),Array.isArray(e.fields)&&e.fields.forEach((o,s)=>{f(o,`fields.${s}`,i)}),e.dateField!==void 0&&f(e.dateField,"dateField",i),e.orderBy!==void 0&&(u(e.orderBy)?(f(e.orderBy.field,"orderBy.field",i,{required:!0}),e.orderBy.direction!=="asc"&&e.orderBy.direction!=="desc"&&i.push(n("invalid_record_order_direction","Records intent orderBy direction must be asc or desc.","orderBy.direction"))):i.push(n("invalid_record_order_by","Records intent orderBy must be a structured object.","orderBy")))):e.kind==="inputOptions"?((!e.field||!d(e.field.name))&&i.push(n("missing_input_options_field","Input options intent needs a field.","field")),f(e.field,"field",i,{required:!0})):e.kind==="sql"?(((r=e.source)==null?void 0:r.kind)!=="sql"&&i.push(n("invalid_sql_source","SQL analytics intent must use a SQL execution source.","source")),d(e.sql)||i.push(n("missing_sql","SQL analytics intent needs SQL text.","sql")),Array.isArray(e.fields)&&e.fields.forEach((o,s)=>{f(o,`fields.${s}`,i)})):i.push(n("invalid_analytics_kind","Analytics kind is not supported.","kind"));return{ok:i.length===0,errors:i,warnings:a,repairHints:D(i)}}function I(e){const i=[],a=[];if(!e||typeof e!="object")return{ok:!1,errors:[n("invalid_operation_intent","Operation intent must be a structured object.")],warnings:a,repairHints:[{code:"invalid_operation_intent",recommendedNextStep:"Send one typed operation intent with version, kind, and required operation fields."}]};if(e.version!==1&&i.push(n("invalid_version","Operation intent version must be 1.","version")),e.kind==="answer_obligations")!Array.isArray(e.obligations)||e.obligations.length===0?i.push(n("missing_obligations","Answer-obligations operation intent needs at least one obligation.","obligations")):e.obligations.forEach((r,o)=>{d(r.id)||i.push(n("missing_obligation_id","Each analytics obligation needs an id.",`obligations.${o}.id`)),d(r.prompt)||i.push(n("missing_obligation_prompt","Each analytics obligation needs a prompt.",`obligations.${o}.prompt`))});else if(e.kind==="dashboard_change"||e.kind==="data_app_change"){if(d(e.instruction)||i.push(n("missing_instruction","Change operation intent needs an instruction.","instruction")),e.analyticsIntent){const r=h(e.analyticsIntent);i.push(...r.errors),a.push(...r.warnings)}}else i.push(n("invalid_operation_kind","Operation intent kind is not supported.","kind"));return{ok:i.length===0,errors:i,warnings:a,repairHints:S(i)}}function F(e){const i=[],a=[];if(!e||typeof e!="object")return{ok:!1,errors:[n("invalid_recovery_plan","Analytics recovery plan must be a structured object.")],warnings:a,repairHints:[{code:"invalid_recovery_plan",recommendedNextStep:"Return a typed recovery plan with operationIntent and plannedToolCalls."}]};e.version!==1&&i.push(n("invalid_version","Recovery plan version must be 1.","version")),e.kind!=="analytics_recovery_plan"&&i.push(n("invalid_recovery_plan_kind","Recovery plan kind must be analytics_recovery_plan.","kind"));const r=I(e.operationIntent);return i.push(...r.errors),a.push(...r.warnings),Array.isArray(e.plannedToolCalls)||i.push(n("invalid_planned_tool_calls","Recovery plan plannedToolCalls must be an array.","plannedToolCalls")),{ok:i.length===0,errors:i,warnings:a,repairHints:S(i)}}function S(e){return e.map(i=>({code:i.code,recommendedNextStep:i.code==="missing_obligations"?"Normalize the user request into one or more typed analytics obligations before recovery planning.":"Correct the operation/recovery contract shape before planning execution."}))}function D(e){return e.map(i=>{switch(i.code){case"missing_source":return{code:i.code,fieldRole:"source",recommendedNextStep:"Provide a semantic, physical, or SQL source before executing analytics."};case"missing_metric":return{code:i.code,fieldRole:"metric",recommendedNextStep:"Choose one exact metric from the grounded schema candidates."};case"missing_record_fields":return{code:i.code,fieldRole:"dimension",recommendedNextStep:"Provide at least one field for the records intent."};case"missing_input_options_field":return{code:i.code,fieldRole:"input",recommendedNextStep:"Provide the exact field whose option values should be listed."};case"missing_sql":return{code:i.code,fieldRole:"sql",recommendedNextStep:"Provide bounded read-only SQL with an explicit outer LIMIT."};case"conflicting_sql":return{code:i.code,fieldRole:"sql",recommendedNextStep:"Use one canonical SQL text location for the intent; prefer top-level sql."};case"missing_semantic_domain":case"missing_dataset_name":case"missing_connection_id":case"missing_table_name":return{code:i.code,fieldRole:"source",recommendedNextStep:"Use grounded catalog metadata to fill the missing source reference."};default:return}}).filter(i=>!!i)}function T(e,i,a,r){if(!e||typeof e!="object"){a.push(n("invalid_view","Dashboard view must be an object.",i));return}if(d(e.title)||a.push(n("missing_view_title","Dashboard view needs a title.",i)),!e.presentation||typeof e.presentation!="object"){a.push(n("missing_presentation","Dashboard view needs a presentation.",`${i}.presentation`));return}if(e.presentation.kind==="text"){d(e.text)||r.push(n("missing_text_content","Text views should include text content.",`${i}.text`));return}if(!e.analytics){a.push(n("missing_view_analytics","Non-text dashboard views need analytics intent.",`${i}.analytics`));return}const o=h(e.analytics);for(const s of o.errors)a.push(n(s.code,s.message,`${i}.analytics${s.path?`.${s.path}`:""}`));for(const s of o.warnings)r.push(n(s.code,s.message,`${i}.analytics${s.path?`.${s.path}`:""}`))}function B(e){const i=[],a=[];if(!e||typeof e!="object")return{ok:!1,errors:[n("invalid_dashboard_intent","Dashboard intent must be a structured object.")],warnings:a};e.version!==1&&i.push(n("invalid_version","Dashboard intent version must be 1.")),e.kind!=="dashboard"&&i.push(n("invalid_kind","Experience intent kind must be dashboard.")),d(e.title)||i.push(n("missing_title","Dashboard intent needs a title.","title"));const r=Array.isArray(e.inputs)?e.inputs:[],o=v(r.filter(u).map(c=>c.id).filter(c=>typeof c=="string"));o&&i.push(n("duplicate_input_id",`Duplicate input id: ${o}.`,"inputs"));for(const[c,l]of r.entries()){const m=`inputs.${c}`;if(!u(l)){i.push(n("invalid_input","Dashboard input must be an object.",m));continue}d(l.id)||i.push(n("missing_input_id","Input needs an id.",`${m}.id`)),d(l.label)||i.push(n("missing_input_label","Input needs a label.",`${m}.label`)),!l.field||!d(l.field.name)?i.push(n("missing_input_field","Input needs a field.",`${m}.field`)):f(l.field,`${m}.field`,i)}const s=Array.isArray(e.sections)?e.sections:[];s.length===0&&i.push(n("missing_sections","Dashboard intent needs at least one section.","sections"));const t=s.flatMap(c=>c&&typeof c=="object"&&Array.isArray(c.views)?c.views.filter(u).map(l=>l.id).filter(l=>!!l):[]),p=v(t);p&&i.push(n("duplicate_view_id",`Duplicate dashboard view id: ${p}.`,"sections"));for(const[c,l]of s.entries()){const m=`sections.${c}`;if(!l||typeof l!="object"){i.push(n("invalid_section","Dashboard section must be an object.",m));continue}if(d(l.title)||i.push(n("missing_section_title","Dashboard section needs a title.",m)),!Array.isArray(l.views)||l.views.length===0){i.push(n("missing_section_views","Dashboard section needs at least one view.",`${m}.views`));continue}for(const[$,M]of l.views.entries())T(M,`${m}.views.${$}`,i,a)}return{ok:i.length===0,errors:i,warnings:a}}exports.preferSemaphorFieldRefMetadata=R;exports.preferSemaphorSourceMetadata=g;exports.semaphorFieldRefsMatch=k;exports.semaphorSourceIdentityKey=_;exports.semaphorSourcesReferToSameDataset=b;exports.validateSemaphorAnalyticsIntent=h;exports.validateSemaphorAnalyticsRecoveryPlan=F;exports.validateSemaphorDashboardIntent=B;exports.validateSemaphorOperationIntent=I;
|