react-semaphor 0.1.348 → 0.1.349
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 +46 -45
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +3 -3
- package/dist/chunks/{braces-Ccvdip75.js → braces-CBMh5wmd.js} +1 -1
- package/dist/chunks/{braces-DDHkbW1c.js → braces-Cc86y9Ov.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-CaeYg4gz.js → calendar-preferences-dialog-C2vX2dga.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-AVORk8vl.js → calendar-preferences-dialog-gMb9JPpz.js} +3 -3
- package/dist/chunks/{chevrons-up-down-B9fTSds9.js → chevrons-up-down-CUZL1zaU.js} +1 -1
- package/dist/chunks/{chevrons-up-down-pV0i9ptS.js → chevrons-up-down-fg3WME_w.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-B7hc62UJ.js → dashboard-briefing-launcher-Cx4NkJil.js} +4 -4
- package/dist/chunks/{dashboard-briefing-launcher-GmwoVZDA.js → dashboard-briefing-launcher-DjzTWk1f.js} +1 -1
- package/dist/chunks/dashboard-controls-BTz9RgtD.js +57 -0
- package/dist/chunks/{dashboard-controls-DOwo-4PX.js → dashboard-controls-Yo3L7krV.js} +129 -119
- package/dist/chunks/{dashboard-json-Bjge3tEx.js → dashboard-json-3_OGzDQh.js} +1 -1
- package/dist/chunks/{dashboard-json-CqWAmaOX.js → dashboard-json-OLpSyYFR.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-NXdSdqQS.js → edit-dashboard-visual-073yhfDG.js} +6 -6
- package/dist/chunks/{edit-dashboard-visual-biDU5oky.js → edit-dashboard-visual-DXzKEyXJ.js} +1 -1
- package/dist/chunks/index-Alj8oDV1.js +1410 -0
- package/dist/chunks/{index-DhuiooCy.js → index-DTSZ23bE.js} +36067 -35746
- package/dist/chunks/{palette-BMXS-AcI.js → palette-C1k347Tb.js} +1 -1
- package/dist/chunks/{palette-DKecBucs.js → palette-DP6TXUD8.js} +1 -1
- package/dist/chunks/{resource-management-panel-DIt7NxsX.js → resource-management-panel-BvTTEaef.js} +3 -3
- package/dist/chunks/{resource-management-panel-MHam0keE.js → resource-management-panel-DLJ6uWYJ.js} +1 -1
- package/dist/chunks/source-identity-C-xaeE_I.js +1 -0
- package/dist/chunks/source-identity-qAmkNtEK.js +49 -0
- package/dist/chunks/{switch-CP7SmEIZ.js → switch-21kU-tcj.js} +2 -2
- package/dist/chunks/{switch-DYRgERrC.js → switch-C0S63HAv.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DS5aPcKd.js → use-create-flow-overlay-state-BMr_844V.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-p_i0aUhH.js → use-create-flow-overlay-state-gRSXj8dj.js} +3 -3
- package/dist/chunks/{use-visual-utils-EazVs86Z.js → use-visual-utils-7w01KGK7.js} +1 -1
- package/dist/chunks/{use-visual-utils-PfpWtYcR.js → use-visual-utils-D5zrmYt8.js} +2 -2
- package/dist/chunks/{validators-C2eI8fHy.js → validators-B-NiYgGc.js} +178 -224
- package/dist/chunks/validators-DlEfynH8.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-assistant/index.cjs +1 -0
- package/dist/dashboard-assistant/index.js +12 -0
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +16 -15
- 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 +32 -31
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard-assistant.d.ts +1030 -0
- package/dist/types/dashboard-authoring.d.ts +1 -1
- package/dist/types/dashboard.d.ts +1 -1
- package/dist/types/main.d.ts +1 -1
- package/dist/types/shared.d.ts +1 -1
- package/dist/types/surfboard.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +6 -1
- package/dist/chunks/dashboard-controls-Bthl3kl3.js +0 -52
- package/dist/chunks/index-D7U5s9Uk.js +0 -1425
- package/dist/chunks/validators-BNvNf_tO.js +0 -1
|
@@ -0,0 +1,1030 @@
|
|
|
1
|
+
declare type AggregateFunction = 'COUNT' | 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Formula metadata for calculated fields (UI-only metadata)
|
|
5
|
+
* This is supplementary data to help the UI display and edit calculated fields.
|
|
6
|
+
* The `expression` field remains the source of truth for the backend.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: This metadata is ALWAYS updated atomically with the expression field.
|
|
9
|
+
* Both are generated together from the same dialog inputs, preventing drift.
|
|
10
|
+
*/
|
|
11
|
+
declare interface CalculatedFieldFormula {
|
|
12
|
+
operation: CalculatedFieldOperation;
|
|
13
|
+
/**
|
|
14
|
+
* Array of full MetricField objects used as inputs to the calculated field.
|
|
15
|
+
*
|
|
16
|
+
* Storing complete Field objects eliminates the need for runtime lookups and ensures:
|
|
17
|
+
* - Table alias resolution works with schema-qualified tables (Issue 1)
|
|
18
|
+
* - All field metadata is available even if the input field isn't selected on the card (Issue 2)
|
|
19
|
+
* - Aggregate functions, filters, and entity info are preserved
|
|
20
|
+
*
|
|
21
|
+
* Each input field contains complete metadata:
|
|
22
|
+
* - name, entityId, entityName, qualifiedEntityName (for table qualification)
|
|
23
|
+
* - aggregate (for proper post-aggregation: SUM(sales) / COUNT(orders))
|
|
24
|
+
* - parameters.filters (for filtered metrics)
|
|
25
|
+
* - dataType and other properties
|
|
26
|
+
*
|
|
27
|
+
* Example: [
|
|
28
|
+
* {name: 'sales', aggregate: 'SUM', entityName: 'sales_data', ...},
|
|
29
|
+
* {name: 'order_id', aggregate: 'COUNT', entityName: 'sales_data', ...}
|
|
30
|
+
* ]
|
|
31
|
+
*/
|
|
32
|
+
inputFields: Array<MetricField | GroupByField>;
|
|
33
|
+
/**
|
|
34
|
+
* Constant value used in scale operations (e.g., multiply by 0.15)
|
|
35
|
+
* Only applicable for 'scale' operation type
|
|
36
|
+
*/
|
|
37
|
+
constant?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Operations supported for calculated fields
|
|
42
|
+
*/
|
|
43
|
+
declare type CalculatedFieldOperation = 'sum' | 'difference' | 'product' | 'ratio' | 'change' | 'percentage' | 'scale' | 'custom';
|
|
44
|
+
|
|
45
|
+
declare interface CardConfig {
|
|
46
|
+
groupByColumns?: GroupByField[];
|
|
47
|
+
metricColumns?: MetricField[];
|
|
48
|
+
pivotByColumns?: PivotByField[];
|
|
49
|
+
sortByColumns?: SortByField[];
|
|
50
|
+
detailColumns?: DetailField[];
|
|
51
|
+
/**
|
|
52
|
+
* Typed source that anchors the query before auto-join materializes an
|
|
53
|
+
* executable joinPlan.baseEntity. This is distinct from
|
|
54
|
+
* DataSource.selectedEntities, which lists available datasets but does not
|
|
55
|
+
* define join-root semantics.
|
|
56
|
+
*/
|
|
57
|
+
queryBaseSource?: SemaphorSourceRef;
|
|
58
|
+
/** Preserves non-detail config when switching to detail tables. */
|
|
59
|
+
detailTableBackup?: DetailTableBackupConfig;
|
|
60
|
+
filters?: FilterGroup;
|
|
61
|
+
joinPlan?: JoinPlan;
|
|
62
|
+
rowLimit?: number;
|
|
63
|
+
/**
|
|
64
|
+
* One or more hierarchies that define drillable paths through dimensions.
|
|
65
|
+
*/
|
|
66
|
+
drillHierarchies?: DrillHierarchy[];
|
|
67
|
+
/**
|
|
68
|
+
* Optional list of dimensions allowed for dynamic drill-down across this card.
|
|
69
|
+
* Used only when drill steps contain `mode: 'dynamicDrill'` or `type: 'dynamic'`.
|
|
70
|
+
*/
|
|
71
|
+
allowedDrillTargets?: Field[];
|
|
72
|
+
/**
|
|
73
|
+
* NOT UOptional preload settings for inline drill previews
|
|
74
|
+
*/
|
|
75
|
+
inlineDrillPreview?: {
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
limit: number;
|
|
78
|
+
mode: 'lazy' | 'preloaded';
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Configuration for on-click dashboard filters triggered by this card.
|
|
82
|
+
*/
|
|
83
|
+
clickFilterInteractions?: ClickFilterInteraction[];
|
|
84
|
+
comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
|
|
85
|
+
targetValue?: number;
|
|
86
|
+
showComparisonInLegend?: boolean;
|
|
87
|
+
showTrendline?: boolean;
|
|
88
|
+
trendlineWindow?: number;
|
|
89
|
+
trendlineGranularity?: 'day' | 'week' | 'month';
|
|
90
|
+
summary?: {
|
|
91
|
+
enabled?: boolean;
|
|
92
|
+
showOnCard?: boolean;
|
|
93
|
+
includeInDashboardSummary?: boolean;
|
|
94
|
+
breakdownDimensions?: GroupByField[];
|
|
95
|
+
};
|
|
96
|
+
rowAggregates?: Array<{
|
|
97
|
+
label?: string;
|
|
98
|
+
function: AggregateFunction;
|
|
99
|
+
groupLevel: string | 'ALL';
|
|
100
|
+
}>;
|
|
101
|
+
columnAggregates?: Array<{
|
|
102
|
+
label?: string;
|
|
103
|
+
function: AggregateFunction;
|
|
104
|
+
pivotLevel: string | 'ALL';
|
|
105
|
+
}>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare interface ClickFilterInteraction {
|
|
109
|
+
mode: 'clickFilter';
|
|
110
|
+
/**
|
|
111
|
+
* What element must be clicked to trigger this interaction.
|
|
112
|
+
* Determines both the matching logic and the filtering behavior.
|
|
113
|
+
*
|
|
114
|
+
* @migration Optional during migration. Will be required in V2.
|
|
115
|
+
* Old configs without trigger will apply to any click (legacy behavior).
|
|
116
|
+
*/
|
|
117
|
+
trigger?: InteractionTrigger;
|
|
118
|
+
/**
|
|
119
|
+
* Fields from the chart element that should be used as filters.
|
|
120
|
+
* e.g., [region, ship_mode] from a stacked bar chart
|
|
121
|
+
*/
|
|
122
|
+
filterFields: Field[];
|
|
123
|
+
/**
|
|
124
|
+
* Should this card visually highlight when clicked?
|
|
125
|
+
*/
|
|
126
|
+
highlightSelf?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Cards this filter applies to (inclusive).
|
|
129
|
+
* If omitted and `excludeCardIds` is also omitted → applies to all cards except self.
|
|
130
|
+
*/
|
|
131
|
+
applyToCardIds?: string[];
|
|
132
|
+
/**
|
|
133
|
+
* Cards to explicitly exclude from receiving this filter.
|
|
134
|
+
* Takes effect only if `applyToCardIds` is undefined (acts as override).
|
|
135
|
+
*/
|
|
136
|
+
excludeCardIds?: string[];
|
|
137
|
+
/**
|
|
138
|
+
* Optional UI label or tooltip.
|
|
139
|
+
*/
|
|
140
|
+
label?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
declare type ConnectionType = 'GoogleSheets' | 'FileUpload' | 'MySQL' | 'MSSQL' | 'PostgreSQL' | 'BigQuery' | 'Redshift' | 'Snowflake' | 'S3' | 'clickhouse' | 'S3Tables' | 'API' | 'none';
|
|
144
|
+
|
|
145
|
+
export declare const DASHBOARD_ASSISTANT_VISUAL_TOOL_PART_TYPES: readonly ["tool-runDashboardAnalysis", "tool-runAdvancedAnalysis", "tool-renderDynamicVisual"];
|
|
146
|
+
|
|
147
|
+
export declare type DashboardAssistantAddToDashboardPayload = {
|
|
148
|
+
cardType: TChartType;
|
|
149
|
+
cardTitle: string;
|
|
150
|
+
data: Record<string, unknown>[];
|
|
151
|
+
dataSource?: DataSource;
|
|
152
|
+
cardConfig?: CardConfig;
|
|
153
|
+
connectionId?: string;
|
|
154
|
+
sql?: string;
|
|
155
|
+
python?: string;
|
|
156
|
+
customVisualPreferences?: {
|
|
157
|
+
url: string;
|
|
158
|
+
componentName: string;
|
|
159
|
+
pluginChartType: string;
|
|
160
|
+
settings?: Record<string, unknown>;
|
|
161
|
+
};
|
|
162
|
+
visualizationMode?: TVisualizationMode;
|
|
163
|
+
dynamicCardPreferences?: TDynamicCardPreferences;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export declare type DashboardAssistantAnalysisRequest = {
|
|
167
|
+
operation: DashboardAssistantOperationKind;
|
|
168
|
+
analyticsIntent: SemaphorAnalyticsIntent;
|
|
169
|
+
chartTitle?: string;
|
|
170
|
+
chartType?: TChartType;
|
|
171
|
+
responseMode?: 'standard' | 'data_only';
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export declare type DashboardAssistantArtifact = {
|
|
175
|
+
kind: 'analysis' | 'dynamic_visual' | 'clarification';
|
|
176
|
+
status: 'ready' | 'partial' | 'failed';
|
|
177
|
+
title?: string;
|
|
178
|
+
question?: string;
|
|
179
|
+
chartType?: TChartType;
|
|
180
|
+
records?: Record<string, unknown>[];
|
|
181
|
+
columns?: SemaphorResultColumn[];
|
|
182
|
+
sql?: string;
|
|
183
|
+
python?: string;
|
|
184
|
+
cardConfig?: CardConfig;
|
|
185
|
+
dataSource?: DataSource;
|
|
186
|
+
suppressVisualRender?: boolean;
|
|
187
|
+
executionResult?: SemaphorAnalyticsExecutionResult;
|
|
188
|
+
dynamicVisual?: DashboardAssistantDynamicVisualArtifact;
|
|
189
|
+
addToDashboard?: DashboardAssistantAddToDashboardPayload;
|
|
190
|
+
warnings?: string[];
|
|
191
|
+
diagnostics?: Record<string, unknown>;
|
|
192
|
+
clarification?: {
|
|
193
|
+
question: string;
|
|
194
|
+
missingInputs: string[];
|
|
195
|
+
candidateOptions?: Array<{
|
|
196
|
+
label: string;
|
|
197
|
+
value: unknown;
|
|
198
|
+
description?: string;
|
|
199
|
+
}>;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export declare type DashboardAssistantDynamicVisualArtifact = {
|
|
204
|
+
renderer: 'dynamic-visual';
|
|
205
|
+
status: 'generated' | 'fallback' | 'failed';
|
|
206
|
+
artifactId: string;
|
|
207
|
+
parentArtifactId?: string;
|
|
208
|
+
title: string;
|
|
209
|
+
rendererCode?: string;
|
|
210
|
+
question: string;
|
|
211
|
+
provenance: 'query_spec' | 'sql' | 'sql+python';
|
|
212
|
+
visualIntent?: TDynamicVisualIntent;
|
|
213
|
+
assistantNote?: string;
|
|
214
|
+
fallback: TDynamicVisualFallback;
|
|
215
|
+
error?: {
|
|
216
|
+
stage: string;
|
|
217
|
+
message: string;
|
|
218
|
+
details?: string[];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export declare type DashboardAssistantInspectMode = 'dashboard_summary' | 'card_context' | 'artifact_context';
|
|
223
|
+
|
|
224
|
+
export declare type DashboardAssistantOperationKind = 'answer' | 'preview_visual' | 'explain_card' | 'add_visual';
|
|
225
|
+
|
|
226
|
+
export declare type DashboardAssistantToolOutput = {
|
|
227
|
+
artifact: DashboardAssistantArtifact;
|
|
228
|
+
executionResult?: SemaphorAnalyticsExecutionResult;
|
|
229
|
+
message?: string;
|
|
230
|
+
error?: string;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export declare type DashboardAssistantTurnContext = {
|
|
234
|
+
selectedSheetId: string | null;
|
|
235
|
+
visibleCards: Array<Record<string, unknown>>;
|
|
236
|
+
activeFilters: unknown[];
|
|
237
|
+
inlineFilters?: unknown[];
|
|
238
|
+
interactionFilters?: unknown[];
|
|
239
|
+
linkedInsightReplacements?: Record<string, unknown>;
|
|
240
|
+
sourceRefs?: unknown[];
|
|
241
|
+
fieldRefs?: unknown[];
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export declare type DashboardAssistantVisualToolName = 'runDashboardAnalysis' | 'runAdvancedAnalysis' | 'renderDynamicVisual';
|
|
245
|
+
|
|
246
|
+
export declare type DashboardAssistantVisualToolPartType = (typeof DASHBOARD_ASSISTANT_VISUAL_TOOL_PART_TYPES)[number];
|
|
247
|
+
|
|
248
|
+
declare interface DatabaseEntityReference {
|
|
249
|
+
connectionId: string;
|
|
250
|
+
connectionType: ConnectionType;
|
|
251
|
+
type: EntityType;
|
|
252
|
+
dbObjectType?: string;
|
|
253
|
+
dialect?: Dialect;
|
|
254
|
+
database?: string;
|
|
255
|
+
schema?: string;
|
|
256
|
+
name: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
declare type DatabaseEntityType = 'table' | 'view' | 'materialized view';
|
|
260
|
+
|
|
261
|
+
declare interface DataModelEntityReference extends DatabaseEntityReference {
|
|
262
|
+
type: 'model';
|
|
263
|
+
id: string;
|
|
264
|
+
label: string;
|
|
265
|
+
description: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare interface DatasetEntityReference extends DatabaseEntityReference {
|
|
269
|
+
type: 'dataset';
|
|
270
|
+
datasetType: 'physical' | 'virtual';
|
|
271
|
+
table?: string | null;
|
|
272
|
+
datamodelId?: string | null;
|
|
273
|
+
sql?: string | null;
|
|
274
|
+
id: string;
|
|
275
|
+
domainId: string;
|
|
276
|
+
label: string;
|
|
277
|
+
description?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare interface DataSource {
|
|
281
|
+
connectionId: string;
|
|
282
|
+
semanticDomainId?: string;
|
|
283
|
+
connectionType: string;
|
|
284
|
+
mode: 'database' | 'upload' | 'url' | 'semanticDomain';
|
|
285
|
+
dbSelection?: {
|
|
286
|
+
database: string;
|
|
287
|
+
schema: string;
|
|
288
|
+
entityType: DatabaseEntityType;
|
|
289
|
+
};
|
|
290
|
+
selectedEntities: SelectedEntities;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
declare const DATE_FORMAT_VALUES: readonly ["MM-DD-YYYY", "YYYY-MM-DD", "MM/DD/YYYY", "DD/MM/YYYY", "MMMM DD, YYYY", "MMM DD, YYYY", "DD MMM YYYY", "YYYY-MM-DD HH:mm", "YYYY-MM-DD HH:mm:ss", "YYYY-MM-DD HH:mm Z", "YYYY-MM-DD HH:mm:ss Z", "Week of MMM DD, YYYY", "Week of MMMM DD, YYYY", "YYYY-WW", "MMM YYYY", "MMMM YYYY", "YYYY-MM", "MM/YYYY", "YYYY MMM", "Q1 YYYY", "YYYY Q1", "1st Quarter YYYY", "YYYY-Q1", "Quarter 1, YYYY", "YYYY", "YY", "custom"];
|
|
294
|
+
|
|
295
|
+
declare type DateFormatValue = (typeof DATE_FORMAT_VALUES)[number];
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Field configuration for detail table columns.
|
|
299
|
+
* Unlike GroupByField, DetailField does not support aggregation or granularity.
|
|
300
|
+
* Columns are selected and displayed as-is from the database.
|
|
301
|
+
*/
|
|
302
|
+
declare interface DetailField extends Omit<Field, 'role' | 'granularity'> {
|
|
303
|
+
role: 'detail';
|
|
304
|
+
dateFormat?: DateFormatValue;
|
|
305
|
+
customFormat?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Optional SQL expression for calculated detail fields.
|
|
308
|
+
*/
|
|
309
|
+
expression?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Formula metadata for calculated fields (used for token qualification).
|
|
312
|
+
*/
|
|
313
|
+
calculatedFormula?: CalculatedFieldFormula;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare interface DetailTableBackupConfig {
|
|
317
|
+
groupByColumns?: GroupByField[];
|
|
318
|
+
metricColumns?: MetricField[];
|
|
319
|
+
pivotByColumns?: PivotByField[];
|
|
320
|
+
sortByColumns?: SortByField[];
|
|
321
|
+
rowAggregates?: Array<{
|
|
322
|
+
label?: string;
|
|
323
|
+
function: AggregateFunction;
|
|
324
|
+
groupLevel: string | 'ALL';
|
|
325
|
+
}>;
|
|
326
|
+
columnAggregates?: Array<{
|
|
327
|
+
label?: string;
|
|
328
|
+
function: AggregateFunction;
|
|
329
|
+
pivotLevel: string | 'ALL';
|
|
330
|
+
}>;
|
|
331
|
+
comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'target' | 'start_vs_end';
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb' | 'mssql';
|
|
335
|
+
|
|
336
|
+
declare interface DrillHierarchy {
|
|
337
|
+
id: string;
|
|
338
|
+
label?: string;
|
|
339
|
+
type: 'static' | 'date';
|
|
340
|
+
steps: DrillHierarchyStep[];
|
|
341
|
+
default?: boolean;
|
|
342
|
+
baseField?: Field;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
declare interface DrillHierarchyStep {
|
|
346
|
+
field: Field;
|
|
347
|
+
mode: 'drillDown';
|
|
348
|
+
preferredChartType?: TChartType;
|
|
349
|
+
breadcrumbLabelTemplate?: string;
|
|
350
|
+
retainFilters?: boolean;
|
|
351
|
+
label?: string;
|
|
352
|
+
linkedInsightId?: string;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
declare type EntityType = 'table' | 'view' | 'materialized view' | 'model' | 'file' | 'dataset' | 'url' | 'upload';
|
|
356
|
+
|
|
357
|
+
declare interface Field {
|
|
358
|
+
/**
|
|
359
|
+
* Unique identifier for this field instance (for joins, UI state, etc.).
|
|
360
|
+
* Should be unique within the context of the query or data model.
|
|
361
|
+
* Example: 'orders.customer_id', 'expr_12345', etc.
|
|
362
|
+
*/
|
|
363
|
+
id: string;
|
|
364
|
+
/**
|
|
365
|
+
* The physical/source column name in the database or data source.
|
|
366
|
+
* Used for mapping to the underlying data model and SQL generation (unless overridden by expression).
|
|
367
|
+
*/
|
|
368
|
+
name: string;
|
|
369
|
+
/**
|
|
370
|
+
* Human-friendly, localizable display name for the UI (table headers, chart axes, etc.).
|
|
371
|
+
*/
|
|
372
|
+
label: string;
|
|
373
|
+
/**
|
|
374
|
+
* Unique, stable, machine-friendly reference name for SQL (AS alias), exports, and scripting.
|
|
375
|
+
* If not provided, should be auto-generated from label or name.
|
|
376
|
+
*/
|
|
377
|
+
alias?: string;
|
|
378
|
+
sourceField?: string;
|
|
379
|
+
qualifiedFieldName: string;
|
|
380
|
+
dataType: string;
|
|
381
|
+
description?: string;
|
|
382
|
+
qualifiedEntityName?: string;
|
|
383
|
+
dateFormat?: DateFormatValue;
|
|
384
|
+
customFormat?: string;
|
|
385
|
+
granularity?: TimeGranularity;
|
|
386
|
+
entityId: string;
|
|
387
|
+
entityName: string;
|
|
388
|
+
entityType: EntityType;
|
|
389
|
+
role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
|
|
390
|
+
expression?: string;
|
|
391
|
+
calculatedFormula?: CalculatedFieldFormula;
|
|
392
|
+
format?: FormatSpec;
|
|
393
|
+
aggregate?: AggregateFunction;
|
|
394
|
+
fieldScope?: FieldScope;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
declare type FieldScope = 'card' | 'sheet' | 'dashboard' | 'domain';
|
|
398
|
+
|
|
399
|
+
declare interface FileEntityReference extends DatabaseEntityReference {
|
|
400
|
+
id: string;
|
|
401
|
+
type: 'file' | 'url' | 'upload';
|
|
402
|
+
label: string;
|
|
403
|
+
description: string;
|
|
404
|
+
originalName: string;
|
|
405
|
+
file?: File;
|
|
406
|
+
url?: string;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
declare interface FilterCondition {
|
|
410
|
+
id: string;
|
|
411
|
+
field: Field;
|
|
412
|
+
operator: Operator;
|
|
413
|
+
value: FilterValue;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
declare interface FilterGroup {
|
|
417
|
+
id: string;
|
|
418
|
+
logicalOperator: LogicalOperator;
|
|
419
|
+
negate: boolean;
|
|
420
|
+
conditions: FilterCondition[];
|
|
421
|
+
groups: FilterGroup[];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare type FilterValue = string | number | boolean | Date | null | [number, number] | [string, string] | string[] | number[];
|
|
425
|
+
|
|
426
|
+
declare type FormatSpec = {
|
|
427
|
+
type: 'number' | 'currency' | 'percent' | 'percentage' | 'scientific';
|
|
428
|
+
locale?: string;
|
|
429
|
+
minimumFractionDigits?: number;
|
|
430
|
+
maximumFractionDigits?: number;
|
|
431
|
+
useGrouping?: boolean;
|
|
432
|
+
prefix?: string;
|
|
433
|
+
suffix?: string;
|
|
434
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
435
|
+
compact?: boolean;
|
|
436
|
+
scale?: number;
|
|
437
|
+
currency?: string;
|
|
438
|
+
percentValueMode?: 'fraction' | 'whole';
|
|
439
|
+
} | {
|
|
440
|
+
type: 'date';
|
|
441
|
+
locale?: string;
|
|
442
|
+
pattern?: string;
|
|
443
|
+
relative?: boolean;
|
|
444
|
+
timezone?: string;
|
|
445
|
+
sourceTimezone?: string;
|
|
446
|
+
prefix?: string;
|
|
447
|
+
suffix?: string;
|
|
448
|
+
} | {
|
|
449
|
+
type: 'duration';
|
|
450
|
+
inputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
451
|
+
outputStyle?: 'compact' | 'digital' | 'long';
|
|
452
|
+
largestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
453
|
+
smallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
454
|
+
maxUnits?: number;
|
|
455
|
+
prefix?: string;
|
|
456
|
+
suffix?: string;
|
|
457
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
458
|
+
} | {
|
|
459
|
+
type: 'string';
|
|
460
|
+
prefix?: string;
|
|
461
|
+
suffix?: string;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
declare interface GroupByField extends Field {
|
|
465
|
+
role: 'groupby';
|
|
466
|
+
granularity?: TimeGranularity;
|
|
467
|
+
/**
|
|
468
|
+
* Optional SQL expression for grouping (e.g., DATE_TRUNC('month', order_date)).
|
|
469
|
+
* If present, used in SELECT and GROUP BY instead of just the column name.
|
|
470
|
+
*/
|
|
471
|
+
expression?: string;
|
|
472
|
+
timeDrillPath?: TimeDrillStep[];
|
|
473
|
+
calculatedFormula?: CalculatedFieldFormula;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Defines what element must be clicked to trigger an interaction.
|
|
478
|
+
*
|
|
479
|
+
* The `type` determines filtering behavior:
|
|
480
|
+
* - 'metric': Captures intersection of ALL dimensions (e.g., country='USA' AND state='CA')
|
|
481
|
+
* - 'attribute': Captures ONLY the clicked dimension (e.g., country='USA')
|
|
482
|
+
*
|
|
483
|
+
* Note: `trigger.type` is different from `field.type`:
|
|
484
|
+
* - trigger.type = filtering behavior ('metric' | 'attribute')
|
|
485
|
+
* - field.type = data type ('dimension' | 'metric' | 'measure')
|
|
486
|
+
*/
|
|
487
|
+
declare interface InteractionTrigger {
|
|
488
|
+
/**
|
|
489
|
+
* Determines filtering behavior when this trigger fires:
|
|
490
|
+
* - 'metric': Capture intersection of all dimensions
|
|
491
|
+
* - 'attribute': Capture only this specific dimension
|
|
492
|
+
*/
|
|
493
|
+
type: 'metric' | 'attribute';
|
|
494
|
+
/**
|
|
495
|
+
* The field (metric or attribute) that must be clicked.
|
|
496
|
+
* For multi-series charts: Use the specific metric Field with unique ID
|
|
497
|
+
* (e.g., Field with id='count_of_orders')
|
|
498
|
+
*/
|
|
499
|
+
field: Field;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export declare function isDashboardAssistantVisualToolPartType(value: string): value is DashboardAssistantVisualToolPartType;
|
|
503
|
+
|
|
504
|
+
declare interface Join {
|
|
505
|
+
id: string;
|
|
506
|
+
source: DatabaseEntityReference;
|
|
507
|
+
target: DatabaseEntityReference;
|
|
508
|
+
joinType: 'INNER' | 'LEFT' | 'RIGHT' | 'FULL';
|
|
509
|
+
joinKeyGroups: JoinKeyGroup[];
|
|
510
|
+
sequence: number;
|
|
511
|
+
relationshipId?: string;
|
|
512
|
+
relationshipName?: string;
|
|
513
|
+
relationshipCardinality?: 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many';
|
|
514
|
+
relationshipTraversalDirection?: 'forward' | 'reverse';
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
declare interface JoinKey {
|
|
518
|
+
id?: string;
|
|
519
|
+
source: Field;
|
|
520
|
+
target: Field;
|
|
521
|
+
operator: string;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
declare interface JoinKeyGroup {
|
|
525
|
+
id: string;
|
|
526
|
+
operator: string;
|
|
527
|
+
keys: JoinKey[];
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
declare interface JoinPlan {
|
|
531
|
+
baseEntity: DatabaseEntityReference;
|
|
532
|
+
joins: Join[];
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
declare type LogicalOperator = 'AND' | 'OR';
|
|
536
|
+
|
|
537
|
+
declare interface MetricField extends Field {
|
|
538
|
+
role: 'metric';
|
|
539
|
+
aggregate?: AggregateFunction;
|
|
540
|
+
/**
|
|
541
|
+
* Optional SQL expression for the metric (e.g., ship_date - order_date).
|
|
542
|
+
* If present, used as aggregate(expression) instead of aggregate(name).
|
|
543
|
+
*/
|
|
544
|
+
expression?: string;
|
|
545
|
+
/**
|
|
546
|
+
* Optional parameters for future extensibility (e.g., window functions).
|
|
547
|
+
* * Example:
|
|
548
|
+
* {
|
|
549
|
+
aggregate: "SUM",
|
|
550
|
+
name: "sales",
|
|
551
|
+
parameters: {
|
|
552
|
+
window: "PARTITION BY region ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW"
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
{
|
|
557
|
+
aggregate: "COUNT",
|
|
558
|
+
name: "order_id",
|
|
559
|
+
parameters: {
|
|
560
|
+
filter: "status = 'Active'"
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
*/
|
|
564
|
+
parameters?: {
|
|
565
|
+
filters?: FilterGroup;
|
|
566
|
+
windowTransform?: WindowTransform;
|
|
567
|
+
};
|
|
568
|
+
aliasTemplate?: string;
|
|
569
|
+
valueAliases?: Record<string, string>;
|
|
570
|
+
/**
|
|
571
|
+
* Formula metadata for calculated fields (UI-only metadata)
|
|
572
|
+
* This is supplementary data to help the UI display and edit calculated fields.
|
|
573
|
+
* The `expression` field remains the source of truth for the backend.
|
|
574
|
+
*
|
|
575
|
+
* IMPORTANT: This metadata is ALWAYS updated atomically with the expression field.
|
|
576
|
+
* Both are generated together from the same dialog inputs, preventing drift.
|
|
577
|
+
*/
|
|
578
|
+
calculatedFormula?: CalculatedFieldFormula;
|
|
579
|
+
/**
|
|
580
|
+
* Indicates the metric expression must be evaluated after row-level filtering,
|
|
581
|
+
* either because it contains an aggregate function directly or depends on a
|
|
582
|
+
* pre-aggregated metric input.
|
|
583
|
+
*/
|
|
584
|
+
isPreAggregated?: boolean;
|
|
585
|
+
comparisonType?: 'none' | 'previous_period' | 'same_period_last_year' | 'start_vs_end' | 'target';
|
|
586
|
+
comparisonDisplay?: 'column' | 'inline' | 'hover';
|
|
587
|
+
targetValue?: number;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
declare type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'contains' | 'startsWith' | 'endsWith' | 'like' | 'not like' | 'in' | 'not in' | 'between' | 'not between' | 'isNull' | 'isNotNull';
|
|
591
|
+
|
|
592
|
+
declare interface PivotByField extends Field {
|
|
593
|
+
role: 'pivotby';
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
declare type SelectedEntities = SelectedEntity[];
|
|
597
|
+
|
|
598
|
+
declare type SelectedEntity = DatabaseEntityReference | DataModelEntityReference | DatasetEntityReference | FileEntityReference;
|
|
599
|
+
|
|
600
|
+
declare type SemaphorAbsoluteTimeWindow = {
|
|
601
|
+
kind: 'absolute';
|
|
602
|
+
start: string;
|
|
603
|
+
end: string;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
declare type SemaphorAggregateFunction = 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX' | 'MEDIAN' | 'DISTINCT';
|
|
607
|
+
|
|
608
|
+
declare type SemaphorAnalyticsExecutionResult = {
|
|
609
|
+
intentId?: string;
|
|
610
|
+
queryId?: string;
|
|
611
|
+
status: SemaphorAnalyticsExecutionStatus;
|
|
612
|
+
resultShape?: SemaphorAnalyticsResult['kind'] | 'period_change';
|
|
613
|
+
intent?: SemaphorAnalyticsIntent;
|
|
614
|
+
compiledQuery?: SemaphorCompiledQuery;
|
|
615
|
+
fieldsUsed?: SemaphorExecutionFieldRef[];
|
|
616
|
+
result?: SemaphorAnalyticsResult;
|
|
617
|
+
validation: SemaphorAnalyticsValidationResult;
|
|
618
|
+
coverage?: {
|
|
619
|
+
answeredObligations: string[];
|
|
620
|
+
missingObligations: string[];
|
|
621
|
+
warnings?: SemaphorAnalyticsValidationIssue[];
|
|
622
|
+
};
|
|
623
|
+
missingFields?: string[];
|
|
624
|
+
warnings?: string[];
|
|
625
|
+
relationshipDiagnostics?: SemaphorRelationshipDiagnostics;
|
|
626
|
+
population?: SemaphorAnalyticsPopulation;
|
|
627
|
+
metadata?: Record<string, unknown>;
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
declare type SemaphorAnalyticsExecutionStatus = 'answered' | 'partial' | 'failed';
|
|
631
|
+
|
|
632
|
+
declare type SemaphorAnalyticsFieldRole = 'metric' | 'dateField' | 'dimension' | 'input' | 'source' | 'sql';
|
|
633
|
+
|
|
634
|
+
declare type SemaphorAnalyticsFilter = SemaphorAnalyticsValueFilter | SemaphorAnalyticsNullFilter;
|
|
635
|
+
|
|
636
|
+
declare type SemaphorAnalyticsFilterBase = {
|
|
637
|
+
id?: string;
|
|
638
|
+
field: SemaphorFieldRef;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
declare type SemaphorAnalyticsFilterOperator = SemaphorInputOperator | 'not_contains' | 'is_null' | 'is_not_null';
|
|
642
|
+
|
|
643
|
+
declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
|
|
644
|
+
|
|
645
|
+
declare type SemaphorAnalyticsNullFilter = SemaphorAnalyticsFilterBase & {
|
|
646
|
+
operator: SemaphorAnalyticsNullFilterOperator;
|
|
647
|
+
values?: never;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
declare type SemaphorAnalyticsNullFilterOperator = 'is_null' | 'is_not_null';
|
|
651
|
+
|
|
652
|
+
declare type SemaphorAnalyticsPopulation = {
|
|
653
|
+
scope: 'filtered_query';
|
|
654
|
+
metrics: Record<string, number | string | null>;
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
declare type SemaphorAnalyticsRepairHint = {
|
|
658
|
+
code: SemaphorAnalyticsValidationCode | string;
|
|
659
|
+
message?: string;
|
|
660
|
+
invalidField?: string;
|
|
661
|
+
fieldRole?: SemaphorAnalyticsFieldRole;
|
|
662
|
+
validMetricCandidates?: string[];
|
|
663
|
+
validDateCandidates?: string[];
|
|
664
|
+
validDimensionCandidates?: string[];
|
|
665
|
+
recommendedNextStep: string;
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
declare type SemaphorAnalyticsResult = SemaphorMetricResult | SemaphorRecordsResult | SemaphorInputOptionsResult | SemaphorSqlResult;
|
|
669
|
+
|
|
670
|
+
declare type SemaphorAnalyticsResultBase = {
|
|
671
|
+
intentId?: string;
|
|
672
|
+
queryPath: SemaphorQueryPath;
|
|
673
|
+
warnings?: string[];
|
|
674
|
+
rowCount?: number;
|
|
675
|
+
rowLimitExceeded?: boolean;
|
|
676
|
+
limit?: number;
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
declare type SemaphorAnalyticsValidationCode = 'missing_source' | 'invalid_source_kind' | 'missing_semantic_domain' | 'missing_dataset_name' | 'missing_connection_id' | 'missing_table_name' | 'missing_sql' | 'missing_metric' | 'missing_record_fields' | 'missing_input_options_field' | 'invalid_metric' | 'invalid_metric_list' | 'invalid_date_field' | 'invalid_dimension' | 'invalid_metric_dimensions' | 'conflicting_sql' | 'sql_policy_violation' | 'unsupported_intent_for_adapter' | 'invalid_analytics_kind' | 'invalid_analytics_intent';
|
|
680
|
+
|
|
681
|
+
declare type SemaphorAnalyticsValidationIssue = SemaphorProtocolIssue & {
|
|
682
|
+
code: SemaphorAnalyticsValidationCode | string;
|
|
683
|
+
fieldRole?: SemaphorAnalyticsFieldRole;
|
|
684
|
+
repairHint?: SemaphorAnalyticsRepairHint;
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
declare type SemaphorAnalyticsValidationResult = {
|
|
688
|
+
ok: boolean;
|
|
689
|
+
errors: SemaphorAnalyticsValidationIssue[];
|
|
690
|
+
warnings: SemaphorAnalyticsValidationIssue[];
|
|
691
|
+
repairHints: SemaphorAnalyticsRepairHint[];
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
declare type SemaphorAnalyticsValueFilter = SemaphorAnalyticsFilterBase & {
|
|
695
|
+
operator?: SemaphorAnalyticsValueFilterOperator;
|
|
696
|
+
values: unknown[];
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
declare type SemaphorAnalyticsValueFilterOperator = Exclude<SemaphorAnalyticsFilterOperator, 'is_null' | 'is_not_null'>;
|
|
700
|
+
|
|
701
|
+
declare type SemaphorCompiledQuery = {
|
|
702
|
+
kind: 'config';
|
|
703
|
+
queryId: string;
|
|
704
|
+
source: SemaphorSourceRef;
|
|
705
|
+
cardType: string;
|
|
706
|
+
connectionId: string;
|
|
707
|
+
cardConfig: unknown;
|
|
708
|
+
cardDataSource: unknown;
|
|
709
|
+
activeFilters?: SemaphorAnalyticsFilter[];
|
|
710
|
+
rowLimit: number;
|
|
711
|
+
analyticsIntent?: SemaphorAnalyticsIntent;
|
|
712
|
+
} | {
|
|
713
|
+
kind: 'sql';
|
|
714
|
+
queryId: string;
|
|
715
|
+
source: Extract<SemaphorSourceRef, {
|
|
716
|
+
kind: 'sql';
|
|
717
|
+
}>;
|
|
718
|
+
connectionId: string;
|
|
719
|
+
dialect: SemaphorDialect;
|
|
720
|
+
sql: string;
|
|
721
|
+
parameters?: Record<string, unknown>;
|
|
722
|
+
pythonCode?: string;
|
|
723
|
+
activeFilters?: SemaphorAnalyticsFilter[];
|
|
724
|
+
rowLimit: number;
|
|
725
|
+
analyticsIntent?: SemaphorAnalyticsIntent;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
declare type SemaphorDialect = 'postgres' | 'mysql' | 'mssql' | 'snowflake' | 'clickhouse' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
|
|
729
|
+
|
|
730
|
+
declare type SemaphorExecutionFieldRef = SemaphorFieldRef & {
|
|
731
|
+
semanticAggregate?: SemaphorAggregateFunction;
|
|
732
|
+
effectiveAggregate?: SemaphorAggregateFunction;
|
|
733
|
+
aggregateSource?: SemaphorMetricAggregateSource;
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
declare type SemaphorFieldRef = {
|
|
737
|
+
name: string;
|
|
738
|
+
label?: string;
|
|
739
|
+
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
740
|
+
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
741
|
+
source?: SemaphorSourceRef;
|
|
742
|
+
aggregate?: SemaphorAggregateFunction;
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
declare type SemaphorInputBinding = {
|
|
746
|
+
inputId: string;
|
|
747
|
+
field?: SemaphorFieldRef;
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
declare type SemaphorInputOperator = '=' | '!=' | 'in' | 'not_in' | 'contains' | 'between' | 'not_between' | '>' | '>=' | '<' | '<=';
|
|
751
|
+
|
|
752
|
+
declare type SemaphorInputOptionsIntent = {
|
|
753
|
+
kind: 'inputOptions';
|
|
754
|
+
version?: SemaphorProtocolVersion;
|
|
755
|
+
id?: string;
|
|
756
|
+
label?: string;
|
|
757
|
+
source: SemaphorSourceRef;
|
|
758
|
+
field: SemaphorFieldRef;
|
|
759
|
+
search?: string;
|
|
760
|
+
limit?: number;
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
declare type SemaphorInputOptionsResult = SemaphorAnalyticsResultBase & {
|
|
764
|
+
kind: 'inputOptions';
|
|
765
|
+
options: Array<{
|
|
766
|
+
label: string;
|
|
767
|
+
value: unknown;
|
|
768
|
+
count?: number;
|
|
769
|
+
}>;
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
declare type SemaphorMetricAggregateSource = 'semantic_model' | 'caller_override' | 'default_sum';
|
|
773
|
+
|
|
774
|
+
declare type SemaphorMetricAnalysis = {
|
|
775
|
+
kind: 'period_change';
|
|
776
|
+
orderBy?: 'absolute_change' | 'positive_change' | 'negative_change' | 'period';
|
|
777
|
+
direction?: 'increase' | 'decrease' | 'both';
|
|
778
|
+
timeWindow?: SemaphorTimeWindow;
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
declare type SemaphorMetricIntent = {
|
|
782
|
+
kind: 'metric';
|
|
783
|
+
version?: SemaphorProtocolVersion;
|
|
784
|
+
id?: string;
|
|
785
|
+
source: SemaphorSourceRef;
|
|
786
|
+
metrics: SemaphorFieldRef[];
|
|
787
|
+
primaryMetric?: SemaphorFieldRef;
|
|
788
|
+
label?: string;
|
|
789
|
+
dateField?: SemaphorFieldRef;
|
|
790
|
+
timeGrain?: SemaphorTimeGrain;
|
|
791
|
+
timeWindow?: SemaphorTimeWindow;
|
|
792
|
+
dimensions?: SemaphorFieldRef[];
|
|
793
|
+
filters?: SemaphorAnalyticsFilter[];
|
|
794
|
+
comparison?: {
|
|
795
|
+
kind: 'previous_period' | 'previous_year' | 'target';
|
|
796
|
+
targetValue?: number;
|
|
797
|
+
};
|
|
798
|
+
analysis?: SemaphorMetricAnalysis;
|
|
799
|
+
orderBy?: {
|
|
800
|
+
field: SemaphorFieldRef;
|
|
801
|
+
direction: 'asc' | 'desc';
|
|
802
|
+
};
|
|
803
|
+
inputs?: SemaphorInputBinding[];
|
|
804
|
+
limit?: number;
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
declare type SemaphorMetricResult = SemaphorAnalyticsResultBase & {
|
|
808
|
+
kind: 'metric';
|
|
809
|
+
value: number | string | null;
|
|
810
|
+
comparison?: {
|
|
811
|
+
kind: NonNullable<SemaphorMetricIntent['comparison']>['kind'];
|
|
812
|
+
value?: number | string | null;
|
|
813
|
+
delta?: number | null;
|
|
814
|
+
deltaPercent?: number | null;
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
declare type SemaphorProtocolIssue = {
|
|
819
|
+
code: string;
|
|
820
|
+
message: string;
|
|
821
|
+
path?: string;
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
declare type SemaphorProtocolVersion = 1;
|
|
825
|
+
|
|
826
|
+
declare type SemaphorQueryPath = 'query_spec' | 'sql' | 'sql_python';
|
|
827
|
+
|
|
828
|
+
declare type SemaphorRecordsIntent = {
|
|
829
|
+
kind: 'records';
|
|
830
|
+
version?: SemaphorProtocolVersion;
|
|
831
|
+
source: SemaphorSourceRef;
|
|
832
|
+
id?: string;
|
|
833
|
+
label?: string;
|
|
834
|
+
fields: SemaphorFieldRef[];
|
|
835
|
+
dateField?: SemaphorFieldRef;
|
|
836
|
+
timeGrain?: SemaphorTimeGrain;
|
|
837
|
+
limit?: number;
|
|
838
|
+
orderBy?: {
|
|
839
|
+
field: SemaphorFieldRef;
|
|
840
|
+
direction: 'asc' | 'desc';
|
|
841
|
+
};
|
|
842
|
+
inputs?: SemaphorInputBinding[];
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
declare type SemaphorRecordsResult = SemaphorAnalyticsResultBase & {
|
|
846
|
+
kind: 'records';
|
|
847
|
+
columns: SemaphorResultColumn[];
|
|
848
|
+
records: Array<Record<string, unknown>>;
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
declare type SemaphorRelationshipDiagnostics = {
|
|
852
|
+
status: SemaphorRelationshipDiagnosticStatus;
|
|
853
|
+
requiredSources?: SemaphorSourceRef[];
|
|
854
|
+
relationshipsUsed?: string[];
|
|
855
|
+
missingSources?: string[];
|
|
856
|
+
warnings?: string[];
|
|
857
|
+
message?: string;
|
|
858
|
+
recommendedNextStep?: string;
|
|
859
|
+
joinPlanSummary?: {
|
|
860
|
+
baseSource?: SemaphorSourceRef;
|
|
861
|
+
joinedSources?: SemaphorSourceRef[];
|
|
862
|
+
joinCount?: number;
|
|
863
|
+
};
|
|
864
|
+
fanoutRisk?: {
|
|
865
|
+
status: 'none' | 'warning' | 'error' | 'unknown';
|
|
866
|
+
message?: string;
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
declare type SemaphorRelationshipDiagnosticStatus = 'not_required' | 'resolved' | 'missing' | 'ambiguous' | 'fanout_risk' | 'unknown';
|
|
871
|
+
|
|
872
|
+
declare type SemaphorRelativeTimeWindow = {
|
|
873
|
+
kind?: 'relative';
|
|
874
|
+
unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
875
|
+
value: number;
|
|
876
|
+
anchor?: 'now' | 'latest_available';
|
|
877
|
+
completeness?: 'include_partial' | 'complete_periods';
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
declare type SemaphorResultColumn = {
|
|
881
|
+
/**
|
|
882
|
+
* Stable row accessor for this result. Consumers should read values with
|
|
883
|
+
* `row[column.key]`; labels are display-only and may change.
|
|
884
|
+
*/
|
|
885
|
+
key: string;
|
|
886
|
+
/**
|
|
887
|
+
* Semantic/source field name before result-key disambiguation.
|
|
888
|
+
*/
|
|
889
|
+
name: string;
|
|
890
|
+
/**
|
|
891
|
+
* Human-facing display label.
|
|
892
|
+
*/
|
|
893
|
+
label: string;
|
|
894
|
+
role?: SemaphorFieldRef['role'];
|
|
895
|
+
dataType?: SemaphorFieldRef['dataType'];
|
|
896
|
+
aggregate?: SemaphorFieldRef['aggregate'];
|
|
897
|
+
source?: SemaphorFieldRef['source'];
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
declare type SemaphorSourceRef = {
|
|
901
|
+
kind: 'semantic';
|
|
902
|
+
domainId: string;
|
|
903
|
+
datasetName: string;
|
|
904
|
+
datasetId?: string;
|
|
905
|
+
label?: string;
|
|
906
|
+
connectionId?: string;
|
|
907
|
+
} | {
|
|
908
|
+
kind: 'physical';
|
|
909
|
+
connectionId: string;
|
|
910
|
+
connectionType?: string;
|
|
911
|
+
tableName: string;
|
|
912
|
+
databaseName?: string;
|
|
913
|
+
schemaName?: string;
|
|
914
|
+
label?: string;
|
|
915
|
+
dialect?: SemaphorDialect;
|
|
916
|
+
} | {
|
|
917
|
+
kind: 'sql';
|
|
918
|
+
connectionId: string;
|
|
919
|
+
dialect?: SemaphorDialect;
|
|
920
|
+
label?: string;
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
declare type SemaphorSqlIntent = {
|
|
924
|
+
kind: 'sql';
|
|
925
|
+
version?: SemaphorProtocolVersion;
|
|
926
|
+
id?: string;
|
|
927
|
+
label?: string;
|
|
928
|
+
source: Extract<SemaphorSourceRef, {
|
|
929
|
+
kind: 'sql';
|
|
930
|
+
}>;
|
|
931
|
+
sql: string;
|
|
932
|
+
parameters?: Record<string, unknown>;
|
|
933
|
+
pythonCode?: string;
|
|
934
|
+
limit?: number;
|
|
935
|
+
rationale?: string;
|
|
936
|
+
fields?: SemaphorFieldRef[];
|
|
937
|
+
inputs?: SemaphorInputBinding[];
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
declare type SemaphorSqlResult = SemaphorAnalyticsResultBase & {
|
|
941
|
+
kind: 'sql';
|
|
942
|
+
columns: SemaphorRecordsResult['columns'];
|
|
943
|
+
records: SemaphorRecordsResult['records'];
|
|
944
|
+
sqlShape?: {
|
|
945
|
+
statementType?: string;
|
|
946
|
+
explicitLimit?: number;
|
|
947
|
+
hasPythonCode?: boolean;
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
952
|
+
|
|
953
|
+
declare type SemaphorTimeWindow = SemaphorRelativeTimeWindow | SemaphorAbsoluteTimeWindow;
|
|
954
|
+
|
|
955
|
+
declare interface SortByField extends Field {
|
|
956
|
+
role: 'sortby';
|
|
957
|
+
direction: 'asc' | 'desc';
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'area' | 'stackedArea' | 'combo' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'pivotTable' | 'aggregateTable' | 'detailTable' | 'tableBuilder' | 'kpi' | 'pyramid' | 'tornado' | 'range' | 'text' | 'map' | 'funnel' | 'bullet' | 'heatmap' | 'treemap' | 'custom';
|
|
961
|
+
|
|
962
|
+
declare type TDynamicCardPreferences = {
|
|
963
|
+
renderer: 'dynamic-visual';
|
|
964
|
+
artifactId?: string;
|
|
965
|
+
parentArtifactId?: string;
|
|
966
|
+
title?: string;
|
|
967
|
+
rendererCode?: string;
|
|
968
|
+
question?: string;
|
|
969
|
+
provenance?: 'card-config' | 'query_spec' | 'sql' | 'sql+python';
|
|
970
|
+
visualIntent?: TDynamicVisualIntent;
|
|
971
|
+
assistantNote?: string;
|
|
972
|
+
builtinDisplayOptions?: {
|
|
973
|
+
showChrome?: boolean;
|
|
974
|
+
allowScroll?: boolean;
|
|
975
|
+
};
|
|
976
|
+
fallback: TDynamicVisualFallback;
|
|
977
|
+
error?: {
|
|
978
|
+
stage: string;
|
|
979
|
+
message: string;
|
|
980
|
+
details?: string[];
|
|
981
|
+
};
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
declare type TDynamicVisualFallback = {
|
|
985
|
+
mode: 'chart' | 'table';
|
|
986
|
+
chartType?: TChartType;
|
|
987
|
+
reason: string;
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
declare type TDynamicVisualIntent = {
|
|
991
|
+
primaryChartType?: TChartType | 'custom';
|
|
992
|
+
layout: 'chart-only' | 'composite';
|
|
993
|
+
includesKpis: boolean;
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
declare interface TimeDrillStep {
|
|
997
|
+
granularity: TimeGranularity;
|
|
998
|
+
next?: TimeGranularity;
|
|
999
|
+
comparison?: 'previous_year' | 'previous_period';
|
|
1000
|
+
rollingWindow?: number;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
declare type TimeGranularity = 'day' | 'week' | 'month' | 'quarter' | 'year' | 'hour' | 'minute' | 'second';
|
|
1004
|
+
|
|
1005
|
+
declare type TVisualizationMode = 'builtin' | 'dynamic';
|
|
1006
|
+
|
|
1007
|
+
declare type WindowFunction = 'running_total' | 'moving_average' | 'previous_period_delta' | 'percent_of_total';
|
|
1008
|
+
|
|
1009
|
+
declare interface WindowTransform {
|
|
1010
|
+
function: WindowFunction;
|
|
1011
|
+
orderBy?: {
|
|
1012
|
+
fieldId: string;
|
|
1013
|
+
direction?: 'asc' | 'desc';
|
|
1014
|
+
};
|
|
1015
|
+
partitionByFieldIds?: string[];
|
|
1016
|
+
frame?: 'unbounded_preceding';
|
|
1017
|
+
movingAverage?: {
|
|
1018
|
+
windowSize?: number;
|
|
1019
|
+
minPeriods?: number;
|
|
1020
|
+
};
|
|
1021
|
+
previousPeriodDelta?: {
|
|
1022
|
+
mode?: 'absolute' | 'percent';
|
|
1023
|
+
};
|
|
1024
|
+
percentOfTotal?: {
|
|
1025
|
+
scope?: 'grand_total' | 'partition_total';
|
|
1026
|
+
output?: 'fraction' | 'percent';
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
export { }
|