react-semaphor 0.1.391 → 0.1.393
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 +120 -252
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +7 -7
- package/dist/chunks/analyze-result-contract-C9Gv2_qW.js +1585 -0
- package/dist/chunks/analyze-result-contract-Zgg-Bbpj.js +1 -0
- package/dist/chunks/{braces--20GzUQh.js → braces-8TRlDwDw.js} +1 -1
- package/dist/chunks/{braces-C0Vh_Mft.js → braces-D2tStQjF.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-B-VsxhsA.js → calendar-preferences-dialog-49fcEPXS.js} +4 -4
- package/dist/chunks/{calendar-preferences-dialog-DE67Z3oQ.js → calendar-preferences-dialog-DwLeBLy2.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-CgkSKkZR.js +80 -0
- package/dist/chunks/{dashboard-briefing-launcher-BIj3X7b3.js → dashboard-briefing-launcher-cgPKz1yX.js} +252 -252
- package/dist/chunks/dashboard-controls-D12ZSUP_.js +52 -0
- package/dist/chunks/{dashboard-controls-BXxucM4f.js → dashboard-controls-VMFm3OP4.js} +87 -87
- package/dist/chunks/{dashboard-json-C6oZuipD.js → dashboard-json-C-GG5yC7.js} +4 -4
- package/dist/chunks/{dashboard-json-BNwshkK2.js → dashboard-json-CvK0oI24.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CmfrI_L3.js → edit-dashboard-visual-B5KB7dx4.js} +977 -977
- package/dist/chunks/edit-dashboard-visual-ql99faTz.js +178 -0
- package/dist/chunks/{index-icb12JV1.js → index-CQmKDEbe.js} +735 -741
- package/dist/chunks/{index-4W_ElSBJ.js → index-DXCBPLDu.js} +218 -223
- package/dist/chunks/{layout-grid-B7-klXiK.js → layout-grid-C0OI-MRn.js} +1 -1
- package/dist/chunks/{layout-grid-DV89AC9_.js → layout-grid-CiubineE.js} +1 -1
- package/dist/chunks/{palette-Dj-dgPYh.js → palette-C4KTXOug.js} +1 -1
- package/dist/chunks/{palette-5IwhMbSF.js → palette-Cp1hqZtm.js} +1 -1
- package/dist/chunks/{save-C5fwVdTF.js → save-C__QggEE.js} +1 -1
- package/dist/chunks/{save-16C6YSW2.js → save-DgMfP0j8.js} +1 -1
- package/dist/chunks/{search-0LmWwZzW.js → search-BHsQIWBV.js} +17 -7
- package/dist/chunks/{search-Dq1Mbb03.js → search-DNCejM7Z.js} +9 -4
- package/dist/chunks/source-identity-uMaUe036.js +1 -0
- package/dist/chunks/{source-identity-CN4xiyKJ.js → source-identity-y0VSSreA.js} +33 -15
- package/dist/chunks/{switch-bdJp0Bkw.js → switch-B79Hn4Qh.js} +27 -32
- package/dist/chunks/{switch-DUdaHFZQ.js → switch-BXQAlSuW.js} +637 -647
- package/dist/chunks/use-create-flow-overlay-state-7MFN3PWX.js +21 -0
- package/dist/chunks/{use-create-flow-overlay-state-YvqCp6Zo.js → use-create-flow-overlay-state-Bw5LRkf9.js} +93 -92
- package/dist/chunks/{validators-CHPH6ORs.js → validators-4EGCWWga.js} +1 -1
- package/dist/chunks/{validators-lWo8m0Q7.js → validators-CPtkrola.js} +1 -1
- package/dist/chunks/{x-B_cx7LwM.js → x-B6ghREd2.js} +10 -5
- package/dist/chunks/{x-IdR_js6f.js → x-CXDkqdur.js} +28 -18
- 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 +3 -3
- package/dist/data-app-builder/index.cjs +13 -13
- package/dist/data-app-builder/index.js +11 -11
- package/dist/data-app-sdk/index.cjs +5 -5
- package/dist/data-app-sdk/index.js +1589 -1234
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +6 -7
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +13 -13
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +2107 -43
- package/dist/types/dashboard-assistant.d.ts +3 -1
- package/dist/types/data-app-sdk-adapters.d.ts +1 -1
- package/dist/types/data-app-sdk-validation.d.ts +4 -2
- package/dist/types/data-app-sdk.d.ts +73 -5
- package/package.json +2 -1
- package/src/data-app-sdk/README.md +55 -0
- package/dist/chunks/analyze-result-contract-CtXfp3nv.js +0 -1
- package/dist/chunks/analyze-result-contract-DuhlklhI.js +0 -102
- package/dist/chunks/dashboard-briefing-launcher-Czx6BcXW.js +0 -80
- package/dist/chunks/dashboard-controls-BP-DcPFs.js +0 -52
- package/dist/chunks/edit-dashboard-visual-BAprin3J.js +0 -178
- package/dist/chunks/source-identity-C-xaeE_I.js +0 -1
- package/dist/chunks/use-create-flow-overlay-state-BIHKf_XK.js +0 -21
|
@@ -907,7 +907,7 @@ declare type SemaphorAnalyticsExecutionResult = {
|
|
|
907
907
|
intentId?: string;
|
|
908
908
|
queryId?: string;
|
|
909
909
|
status: SemaphorAnalyticsExecutionStatus;
|
|
910
|
-
resultShape?:
|
|
910
|
+
resultShape?: SemaphorAnalyticsExecutionResultShape;
|
|
911
911
|
intent?: SemaphorAnalyticsIntent;
|
|
912
912
|
compiledQuery?: SemaphorCompiledQuery;
|
|
913
913
|
fieldsUsed?: SemaphorExecutionFieldRef[];
|
|
@@ -926,6 +926,8 @@ declare type SemaphorAnalyticsExecutionResult = {
|
|
|
926
926
|
metadata?: Record<string, unknown>;
|
|
927
927
|
};
|
|
928
928
|
|
|
929
|
+
declare type SemaphorAnalyticsExecutionResultShape = SemaphorAnalyticsResult['kind'] | 'period_change' | 'analysis';
|
|
930
|
+
|
|
929
931
|
declare type SemaphorAnalyticsExecutionStatus = 'answered' | 'partial' | 'failed';
|
|
930
932
|
|
|
931
933
|
declare type SemaphorAnalyticsFieldRole = 'measure' | 'date' | 'dimension' | 'input' | 'source' | 'sql';
|
|
@@ -71,7 +71,6 @@ declare type SemaphorAnalysisQueryOptions = {
|
|
|
71
71
|
declare type SemaphorAnalysisQuerySpec = SemaphorMetricQuerySpec & SemaphorAnalysisQueryOptions & {
|
|
72
72
|
analysis?: SemaphorMetricIntent['analysis'];
|
|
73
73
|
timeWindow?: SemaphorMetricIntent['timeWindow'];
|
|
74
|
-
filters?: SemaphorAnalyticsFilter[];
|
|
75
74
|
};
|
|
76
75
|
|
|
77
76
|
declare type SemaphorAnalyticsFilter = SemaphorAnalyticsValueFilter | SemaphorAnalyticsNullFilter;
|
|
@@ -478,6 +477,7 @@ declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDeri
|
|
|
478
477
|
dimensions?: SemaphorQueryField[];
|
|
479
478
|
comparison?: SemaphorMetricComparison;
|
|
480
479
|
orderBy?: SemaphorQueryOrderBy;
|
|
480
|
+
filters?: SemaphorAnalyticsFilter[];
|
|
481
481
|
inputs?: SemaphorInputReference[];
|
|
482
482
|
relationshipHint?: SemaphorRelationshipHint;
|
|
483
483
|
limit?: number;
|
|
@@ -314,7 +314,6 @@ export declare type SemaphorAnalysisQueryOptionsValidationResult = {
|
|
|
314
314
|
declare type SemaphorAnalysisQuerySpec = SemaphorMetricQuerySpec & SemaphorAnalysisQueryOptions & {
|
|
315
315
|
analysis?: SemaphorMetricIntent['analysis'];
|
|
316
316
|
timeWindow?: SemaphorMetricIntent['timeWindow'];
|
|
317
|
-
filters?: SemaphorAnalyticsFilter[];
|
|
318
317
|
};
|
|
319
318
|
|
|
320
319
|
export declare type SemaphorAnalysisTimezoneValidator = (tz: string) => string | null;
|
|
@@ -364,7 +363,7 @@ declare type SemaphorAnalyticsExecutionResult = {
|
|
|
364
363
|
intentId?: string;
|
|
365
364
|
queryId?: string;
|
|
366
365
|
status: SemaphorAnalyticsExecutionStatus;
|
|
367
|
-
resultShape?:
|
|
366
|
+
resultShape?: SemaphorAnalyticsExecutionResultShape;
|
|
368
367
|
intent?: SemaphorAnalyticsIntent;
|
|
369
368
|
compiledQuery?: SemaphorCompiledQuery;
|
|
370
369
|
fieldsUsed?: SemaphorExecutionFieldRef[];
|
|
@@ -383,6 +382,8 @@ declare type SemaphorAnalyticsExecutionResult = {
|
|
|
383
382
|
metadata?: Record<string, unknown>;
|
|
384
383
|
};
|
|
385
384
|
|
|
385
|
+
declare type SemaphorAnalyticsExecutionResultShape = SemaphorAnalyticsResult['kind'] | 'period_change' | 'analysis';
|
|
386
|
+
|
|
386
387
|
declare type SemaphorAnalyticsExecutionStatus = 'answered' | 'partial' | 'failed';
|
|
387
388
|
|
|
388
389
|
declare type SemaphorAnalyticsFieldRole = 'measure' | 'date' | 'dimension' | 'input' | 'source' | 'sql';
|
|
@@ -955,6 +956,7 @@ declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & SemaphorAppDeri
|
|
|
955
956
|
dimensions?: SemaphorQueryField[];
|
|
956
957
|
comparison?: SemaphorMetricComparison;
|
|
957
958
|
orderBy?: SemaphorQueryOrderBy;
|
|
959
|
+
filters?: SemaphorAnalyticsFilter[];
|
|
958
960
|
inputs?: SemaphorInputReference[];
|
|
959
961
|
relationshipHint?: SemaphorRelationshipHint;
|
|
960
962
|
limit?: number;
|
|
@@ -408,17 +408,25 @@ export declare type SemaphorAnalysisPayload = {
|
|
|
408
408
|
answerSummary?: string;
|
|
409
409
|
mode?: string;
|
|
410
410
|
data?: Record<string, unknown>;
|
|
411
|
-
resultSets?: Record<string, SemaphorAnalysisResultSet>;
|
|
411
|
+
resultSets?: Partial<Record<SemaphorAnalysisResultSetKey, SemaphorAnalysisResultSet>> & Record<string, SemaphorAnalysisResultSet>;
|
|
412
|
+
analysisWarnings?: SemaphorAnalysisWarning[];
|
|
413
|
+
warnings?: unknown[];
|
|
412
414
|
columns?: SemaphorResultColumn[];
|
|
413
415
|
records?: Array<Record<string, unknown>>;
|
|
414
416
|
rowCount?: number;
|
|
417
|
+
primary?: Array<Record<string, unknown>>;
|
|
418
|
+
comparison?: unknown;
|
|
419
|
+
comparisons?: Array<Record<string, unknown>>;
|
|
420
|
+
contributors?: Array<Record<string, unknown>>;
|
|
421
|
+
segments?: Array<Record<string, unknown>>;
|
|
422
|
+
periodChanges?: Array<Record<string, unknown>>;
|
|
415
423
|
changes?: Array<Record<string, unknown>>;
|
|
416
424
|
drivers?: Array<Record<string, unknown>>;
|
|
425
|
+
absoluteDeltaDrivers?: Array<Record<string, unknown>>;
|
|
417
426
|
largestNegativeChanges?: Array<Record<string, unknown>>;
|
|
418
427
|
largestPositiveChanges?: Array<Record<string, unknown>>;
|
|
419
428
|
largestNegativeDrivers?: Array<Record<string, unknown>>;
|
|
420
429
|
largestPositiveDrivers?: Array<Record<string, unknown>>;
|
|
421
|
-
comparison?: Record<string, unknown>;
|
|
422
430
|
fieldsUsed?: Record<string, unknown>;
|
|
423
431
|
metadata?: Record<string, unknown>;
|
|
424
432
|
querySpec?: Record<string, unknown>;
|
|
@@ -447,13 +455,36 @@ export declare type SemaphorAnalysisQueryResult = SemaphorQueryState & SemaphorA
|
|
|
447
455
|
export declare type SemaphorAnalysisQuerySpec = SemaphorMetricQuerySpec & SemaphorAnalysisQueryOptions & {
|
|
448
456
|
analysis?: SemaphorMetricIntent['analysis'];
|
|
449
457
|
timeWindow?: SemaphorMetricIntent['timeWindow'];
|
|
450
|
-
filters?: SemaphorAnalyticsFilter[];
|
|
451
458
|
};
|
|
452
459
|
|
|
453
460
|
export declare type SemaphorAnalysisResultSet = {
|
|
461
|
+
id?: SemaphorAnalysisResultSetKey | string;
|
|
462
|
+
role?: SemaphorAnalysisResultSetKey | string;
|
|
454
463
|
records: Array<Record<string, unknown>>;
|
|
455
464
|
columns: SemaphorResultColumn[];
|
|
456
465
|
rowCount?: number;
|
|
466
|
+
warnings?: SemaphorAnalysisWarning[];
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
export declare type SemaphorAnalysisResultSetKey = 'primary' | 'comparisons' | 'contributors' | 'segments' | 'periodChanges' | 'records' | 'changes' | 'drivers' | 'absoluteDeltaDrivers' | 'largestNegativeChanges' | 'largestPositiveChanges' | 'largestNegativeDrivers' | 'largestPositiveDrivers';
|
|
470
|
+
|
|
471
|
+
export declare type SemaphorAnalysisResultSetWarning = {
|
|
472
|
+
code: 'missing_analysis_result_key';
|
|
473
|
+
severity: 'warning';
|
|
474
|
+
message: string;
|
|
475
|
+
resultSetKey: SemaphorAnalysisResultSetKey | string;
|
|
476
|
+
rowIndex: number;
|
|
477
|
+
columnKey: string;
|
|
478
|
+
columnName?: string;
|
|
479
|
+
columnLabel?: string;
|
|
480
|
+
availableKeys: string[];
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
export declare type SemaphorAnalysisWarning = SemaphorAnalysisResultSetWarning | {
|
|
484
|
+
code: string;
|
|
485
|
+
severity?: string;
|
|
486
|
+
message?: string;
|
|
487
|
+
[key: string]: unknown;
|
|
457
488
|
};
|
|
458
489
|
|
|
459
490
|
declare type SemaphorAnalyticsDiagnosticAnsweredItem = {
|
|
@@ -501,7 +532,7 @@ declare type SemaphorAnalyticsExecutionResult = {
|
|
|
501
532
|
intentId?: string;
|
|
502
533
|
queryId?: string;
|
|
503
534
|
status: SemaphorAnalyticsExecutionStatus;
|
|
504
|
-
resultShape?:
|
|
535
|
+
resultShape?: SemaphorAnalyticsExecutionResultShape;
|
|
505
536
|
intent?: SemaphorAnalyticsIntent;
|
|
506
537
|
compiledQuery?: SemaphorCompiledQuery;
|
|
507
538
|
fieldsUsed?: SemaphorExecutionFieldRef[];
|
|
@@ -520,6 +551,8 @@ declare type SemaphorAnalyticsExecutionResult = {
|
|
|
520
551
|
metadata?: Record<string, unknown>;
|
|
521
552
|
};
|
|
522
553
|
|
|
554
|
+
declare type SemaphorAnalyticsExecutionResultShape = SemaphorAnalyticsResult['kind'] | 'period_change' | 'analysis';
|
|
555
|
+
|
|
523
556
|
declare type SemaphorAnalyticsExecutionStatus = 'answered' | 'partial' | 'failed';
|
|
524
557
|
|
|
525
558
|
declare type SemaphorAnalyticsFieldRole = 'measure' | 'date' | 'dimension' | 'input' | 'source' | 'sql';
|
|
@@ -666,9 +699,23 @@ export declare type SemaphorDataAppDefinition = {
|
|
|
666
699
|
views: SemaphorDataAppViewDefinition[];
|
|
667
700
|
};
|
|
668
701
|
|
|
702
|
+
export declare type SemaphorDataAppDevtoolsIssue = {
|
|
703
|
+
traceId: string;
|
|
704
|
+
queryId: string;
|
|
705
|
+
viewId?: string;
|
|
706
|
+
viewTitle?: string;
|
|
707
|
+
queryLabel?: string;
|
|
708
|
+
severity: 'error' | 'warning';
|
|
709
|
+
title: string;
|
|
710
|
+
message: string;
|
|
711
|
+
code?: string;
|
|
712
|
+
path?: string;
|
|
713
|
+
};
|
|
714
|
+
|
|
669
715
|
export declare type SemaphorDataAppDevtoolsState = {
|
|
670
716
|
enabled: boolean;
|
|
671
717
|
queries: SemaphorDataAppTrace[];
|
|
718
|
+
issues: SemaphorDataAppDevtoolsIssue[];
|
|
672
719
|
getQuery(queryId: string): SemaphorDataAppTrace | undefined;
|
|
673
720
|
getQueries(queryId: string): SemaphorDataAppTrace[];
|
|
674
721
|
};
|
|
@@ -683,6 +730,7 @@ export declare type SemaphorDataAppDevtoolsWindowBridge = {
|
|
|
683
730
|
snapshot(): SemaphorDataAppDevtoolsState;
|
|
684
731
|
getQuery(queryId: string): SemaphorDataAppTrace | undefined;
|
|
685
732
|
getQueries(queryId: string): SemaphorDataAppTrace[];
|
|
733
|
+
getIssues(): SemaphorDataAppDevtoolsIssue[];
|
|
686
734
|
};
|
|
687
735
|
|
|
688
736
|
export declare function SemaphorDataAppProvider({ token, apiBaseUrl, executor, debug, children, }: SemaphorDataAppProviderProps): JSX.Element;
|
|
@@ -693,6 +741,15 @@ export declare type SemaphorDataAppProviderProps = SemaphorQueryExecutorContext
|
|
|
693
741
|
children: ReactNode;
|
|
694
742
|
};
|
|
695
743
|
|
|
744
|
+
export declare type SemaphorDataAppQueryError = Error & {
|
|
745
|
+
kind: 'data_app_query_error';
|
|
746
|
+
requestId?: string;
|
|
747
|
+
details?: unknown;
|
|
748
|
+
executionResult?: SemaphorAnalyticsExecutionResult;
|
|
749
|
+
validation?: SemaphorAnalyticsValidationResult;
|
|
750
|
+
validationIssues?: SemaphorAnalyticsValidationIssue[];
|
|
751
|
+
};
|
|
752
|
+
|
|
696
753
|
export declare type SemaphorDataAppSourceHint = {
|
|
697
754
|
file?: string;
|
|
698
755
|
line?: number;
|
|
@@ -1266,6 +1323,7 @@ export declare type SemaphorMetricQuerySpec = SemaphorQuerySourceSpec & Semaphor
|
|
|
1266
1323
|
dimensions?: SemaphorQueryField[];
|
|
1267
1324
|
comparison?: SemaphorMetricComparison;
|
|
1268
1325
|
orderBy?: SemaphorQueryOrderBy;
|
|
1326
|
+
filters?: SemaphorAnalyticsFilter[];
|
|
1269
1327
|
inputs?: SemaphorInputReference[];
|
|
1270
1328
|
relationshipHint?: SemaphorRelationshipHint;
|
|
1271
1329
|
limit?: number;
|
|
@@ -1377,8 +1435,18 @@ export declare type SemaphorQuerySourceSpec = {
|
|
|
1377
1435
|
|
|
1378
1436
|
export declare type SemaphorQueryState = {
|
|
1379
1437
|
status: SemaphorQueryStatus;
|
|
1438
|
+
executionStatus?: SemaphorAnalyticsExecutionStatus;
|
|
1439
|
+
executionResult?: SemaphorAnalyticsExecutionResult;
|
|
1440
|
+
validation?: SemaphorAnalyticsValidationResult;
|
|
1441
|
+
coverage?: SemaphorAnalyticsExecutionResult['coverage'];
|
|
1442
|
+
diagnosticFeedback?: SemaphorAnalyticsExecutionResult['diagnosticFeedback'];
|
|
1380
1443
|
isLoading: boolean;
|
|
1381
|
-
|
|
1444
|
+
isEmpty: boolean;
|
|
1445
|
+
isPartial: boolean;
|
|
1446
|
+
isFiltered: boolean;
|
|
1447
|
+
isStale: boolean;
|
|
1448
|
+
isValidated: boolean;
|
|
1449
|
+
error: SemaphorDataAppQueryError | null;
|
|
1382
1450
|
trace?: SemaphorDataAppTrace;
|
|
1383
1451
|
};
|
|
1384
1452
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "support@semaphor.cloud"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.393",
|
|
9
9
|
"description": "Fully interactive and customizable dashboards for your apps.",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"react",
|
|
@@ -218,6 +218,7 @@
|
|
|
218
218
|
"tailwind-merge": "^2.1.0",
|
|
219
219
|
"tailwindcss-animate": "^1.0.7",
|
|
220
220
|
"uuid": "^9.0.1",
|
|
221
|
+
"zod": "^3.25.76",
|
|
221
222
|
"zustand": "^5.0.9"
|
|
222
223
|
},
|
|
223
224
|
"peerDependencies": {
|
|
@@ -65,6 +65,61 @@ const result = useSemaphorQuery(revenueBySegment, {
|
|
|
65
65
|
});
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
## Query State
|
|
69
|
+
|
|
70
|
+
`useSemaphorQuery` returns normal loading/error fields plus the governed
|
|
71
|
+
Semaphor execution result fields. Generated apps should branch on these public
|
|
72
|
+
fields instead of inspecting nested payload internals.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
const result = useSemaphorQuery(revenueBySegment, {
|
|
76
|
+
inputs: [segmentHandle],
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
if (result.isLoading && !result.isStale) return <Spinner />;
|
|
80
|
+
if (result.isStale) return <Table rows={result.records} subdued />;
|
|
81
|
+
|
|
82
|
+
if (result.status === "error") {
|
|
83
|
+
return (
|
|
84
|
+
<ErrorPanel
|
|
85
|
+
message={result.error?.message ?? "Query failed"}
|
|
86
|
+
issues={result.validation?.errors ?? result.error?.validationIssues ?? []}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (result.isEmpty) return <EmptyState />;
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
{result.isPartial ? <WarningBanner issues={result.coverage?.warnings} /> : null}
|
|
96
|
+
{result.isFiltered ? <FilterIndicator /> : null}
|
|
97
|
+
{result.isValidated ? <ValidationBadge status={result.executionStatus} /> : null}
|
|
98
|
+
<Table rows={result.records} />
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Important state fields:
|
|
104
|
+
|
|
105
|
+
- `executionStatus`: governed execution status, usually `answered`, `partial`,
|
|
106
|
+
or `failed` when the server or SDK produced an execution result.
|
|
107
|
+
- `executionResult`: full `SemaphorAnalyticsExecutionResult` for audit,
|
|
108
|
+
diagnostics, coverage, and result metadata.
|
|
109
|
+
- `validation`, `coverage`, and `diagnosticFeedback`: top-level aliases from
|
|
110
|
+
`executionResult` or structured SDK validation errors.
|
|
111
|
+
- `isEmpty`: successful query returned no meaningful rows/options/cells/value.
|
|
112
|
+
- `isPartial`: execution status, coverage, diagnostic feedback, or row-limit
|
|
113
|
+
metadata says the result is incomplete.
|
|
114
|
+
- `isFiltered`: one or more active filter inputs were applied to the query.
|
|
115
|
+
- `isStale`: previous successful data is being shown while newer inputs load.
|
|
116
|
+
- `isValidated`: validation metadata is present.
|
|
117
|
+
|
|
118
|
+
Validation failures produce a structured `SemaphorDataAppQueryError` in
|
|
119
|
+
`result.error`, with `kind: "data_app_query_error"`, `validation`,
|
|
120
|
+
`validationIssues`, and `executionResult` when available. DevTools traces expose
|
|
121
|
+
the same execution status and structured issues.
|
|
122
|
+
|
|
68
123
|
## Source And Fields
|
|
69
124
|
|
|
70
125
|
```tsx
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t={answerSummary:"string",responseDetail:"responseDetail",mode:"string",comparisonType:"string",executionResult:"unknown",compiledQuery:"unknown",data:"unknown",resultSets:"record",columns:"unknownArray",records:"recordArray",rowCount:"number",rowLimitExceeded:"boolean",output:"string",querySpec:"unknown",metadata:"record",validation:"unknown",coverage:"unknown",diagnosticFeedback:"unknown",missingFields:"stringArray",warnings:"unknownArray",comparison:"unknown",population:"unknown",comparisons:"recordArray",fieldsUsed:"unknown",changes:"recordArray",largestNegativeChanges:"recordArray",largestPositiveChanges:"recordArray",drivers:"recordArray",absoluteDeltaDrivers:"recordArray",largestNegativeDrivers:"recordArray",largestPositiveDrivers:"recordArray",periodRows:"recordArray",sql:"unknown",omitted:"stringArray"},u=new Set(Object.keys(t)),y=new Set(["compact","standard","debug"]);function d(){return Object.keys(t)}function c(r){return u.has(r)}function A(r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Semaphor analyze result must be an object.");const e=r,n=Object.keys(e).filter(o=>!c(o));if(n.length)throw new Error(`Semaphor analyze result contains unsupported top-level field(s): ${n.join(", ")}.`);for(const[o,s]of Object.entries(e)){if(s===void 0)continue;const a=t[o];if(!l(s,a))throw new Error(`Semaphor analyze result field "${o}" does not match contract kind "${a}".`)}return e}function l(r,e){switch(e){case"boolean":return typeof r=="boolean";case"number":return typeof r=="number"&&Number.isFinite(r);case"record":return i(r);case"recordArray":return Array.isArray(r)&&r.every(i);case"responseDetail":return typeof r=="string"&&y.has(r);case"string":return typeof r=="string";case"stringArray":return Array.isArray(r)&&r.every(n=>typeof n=="string");case"unknown":return!0;case"unknownArray":return Array.isArray(r)}}function i(r){return!!(r&&typeof r=="object"&&!Array.isArray(r))}exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=t;exports.getSemaphorAnalyzeResultFieldNames=d;exports.isSemaphorAnalyzeResultFieldName=c;exports.parseSemaphorAnalyzeResult=A;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
const t = {
|
|
2
|
-
answerSummary: "string",
|
|
3
|
-
responseDetail: "responseDetail",
|
|
4
|
-
mode: "string",
|
|
5
|
-
comparisonType: "string",
|
|
6
|
-
executionResult: "unknown",
|
|
7
|
-
compiledQuery: "unknown",
|
|
8
|
-
data: "unknown",
|
|
9
|
-
resultSets: "record",
|
|
10
|
-
columns: "unknownArray",
|
|
11
|
-
records: "recordArray",
|
|
12
|
-
rowCount: "number",
|
|
13
|
-
rowLimitExceeded: "boolean",
|
|
14
|
-
output: "string",
|
|
15
|
-
querySpec: "unknown",
|
|
16
|
-
metadata: "record",
|
|
17
|
-
validation: "unknown",
|
|
18
|
-
coverage: "unknown",
|
|
19
|
-
diagnosticFeedback: "unknown",
|
|
20
|
-
missingFields: "stringArray",
|
|
21
|
-
warnings: "unknownArray",
|
|
22
|
-
comparison: "unknown",
|
|
23
|
-
population: "unknown",
|
|
24
|
-
comparisons: "recordArray",
|
|
25
|
-
fieldsUsed: "unknown",
|
|
26
|
-
changes: "recordArray",
|
|
27
|
-
largestNegativeChanges: "recordArray",
|
|
28
|
-
largestPositiveChanges: "recordArray",
|
|
29
|
-
drivers: "recordArray",
|
|
30
|
-
absoluteDeltaDrivers: "recordArray",
|
|
31
|
-
largestNegativeDrivers: "recordArray",
|
|
32
|
-
largestPositiveDrivers: "recordArray",
|
|
33
|
-
periodRows: "recordArray",
|
|
34
|
-
sql: "unknown",
|
|
35
|
-
omitted: "stringArray"
|
|
36
|
-
}, c = new Set(
|
|
37
|
-
Object.keys(t)
|
|
38
|
-
), u = /* @__PURE__ */ new Set([
|
|
39
|
-
"compact",
|
|
40
|
-
"standard",
|
|
41
|
-
"debug"
|
|
42
|
-
]);
|
|
43
|
-
function A() {
|
|
44
|
-
return Object.keys(
|
|
45
|
-
t
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
function y(r) {
|
|
49
|
-
return c.has(r);
|
|
50
|
-
}
|
|
51
|
-
function l(r) {
|
|
52
|
-
if (!r || typeof r != "object" || Array.isArray(r))
|
|
53
|
-
throw new Error("Semaphor analyze result must be an object.");
|
|
54
|
-
const e = r, n = Object.keys(e).filter(
|
|
55
|
-
(o) => !y(o)
|
|
56
|
-
);
|
|
57
|
-
if (n.length)
|
|
58
|
-
throw new Error(
|
|
59
|
-
`Semaphor analyze result contains unsupported top-level field(s): ${n.join(", ")}.`
|
|
60
|
-
);
|
|
61
|
-
for (const [o, s] of Object.entries(e)) {
|
|
62
|
-
if (s === void 0)
|
|
63
|
-
continue;
|
|
64
|
-
const a = t[o];
|
|
65
|
-
if (!d(s, a))
|
|
66
|
-
throw new Error(
|
|
67
|
-
`Semaphor analyze result field "${o}" does not match contract kind "${a}".`
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
return e;
|
|
71
|
-
}
|
|
72
|
-
function d(r, e) {
|
|
73
|
-
switch (e) {
|
|
74
|
-
case "boolean":
|
|
75
|
-
return typeof r == "boolean";
|
|
76
|
-
case "number":
|
|
77
|
-
return typeof r == "number" && Number.isFinite(r);
|
|
78
|
-
case "record":
|
|
79
|
-
return i(r);
|
|
80
|
-
case "recordArray":
|
|
81
|
-
return Array.isArray(r) && r.every(i);
|
|
82
|
-
case "responseDetail":
|
|
83
|
-
return typeof r == "string" && u.has(r);
|
|
84
|
-
case "string":
|
|
85
|
-
return typeof r == "string";
|
|
86
|
-
case "stringArray":
|
|
87
|
-
return Array.isArray(r) && r.every((n) => typeof n == "string");
|
|
88
|
-
case "unknown":
|
|
89
|
-
return !0;
|
|
90
|
-
case "unknownArray":
|
|
91
|
-
return Array.isArray(r);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function i(r) {
|
|
95
|
-
return !!(r && typeof r == "object" && !Array.isArray(r));
|
|
96
|
-
}
|
|
97
|
-
export {
|
|
98
|
-
t as S,
|
|
99
|
-
A as g,
|
|
100
|
-
y as i,
|
|
101
|
-
l as p
|
|
102
|
-
};
|