react-semaphor 0.1.386 → 0.1.388

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.
@@ -80,6 +80,8 @@ export declare function isAnalyticsTechnicalIdentifierField(field: AnalyticsCata
80
80
 
81
81
  export declare function isSemaphorAnalyzeResultFieldName(value: string): value is SemaphorAnalyzeResultFieldName;
82
82
 
83
+ export declare function isSemaphorDataAppCodegenSummary(value: unknown): value is SemaphorDataAppCodegenSummary;
84
+
83
85
  export declare type MatrixAxisLevelDescriptor = {
84
86
  instanceId: string;
85
87
  fieldKey: string;
@@ -668,6 +670,8 @@ export declare const SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT: {
668
670
  readonly omitted: "stringArray";
669
671
  };
670
672
 
673
+ export declare const SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION: "semaphor-data-app-codegen-summary/v1";
674
+
671
675
  export declare type SemaphorAbsoluteTimeWindow = {
672
676
  kind: 'absolute';
673
677
  start: string;
@@ -959,6 +963,118 @@ export declare type SemaphorDashboardViewIntent = {
959
963
  text?: string;
960
964
  };
961
965
 
966
+ export declare type SemaphorDataAppCodegenFieldRef = SemaphorFieldRef & {
967
+ sourceKey?: string;
968
+ };
969
+
970
+ export declare type SemaphorDataAppCodegenInput = {
971
+ id: string;
972
+ label?: string;
973
+ type?: string;
974
+ serverSide?: boolean;
975
+ fieldRef?: SemaphorDataAppCodegenFieldRef;
976
+ optionQuery?: SemaphorDataAppCodegenInputOptionQuery;
977
+ bindings?: SemaphorDataAppCodegenInputBinding[];
978
+ appliesToViewIds: string[];
979
+ relationshipHint?: SemaphorRelationshipHint;
980
+ relationshipsUsed?: Array<Record<string, unknown>>;
981
+ };
982
+
983
+ export declare type SemaphorDataAppCodegenInputBinding = {
984
+ appliesToViewIds: string[];
985
+ fieldRef: SemaphorDataAppCodegenFieldRef;
986
+ relationshipHint?: SemaphorRelationshipHint;
987
+ relationshipsUsed?: Array<Record<string, unknown>>;
988
+ };
989
+
990
+ export declare type SemaphorDataAppCodegenInputOptionQuery = {
991
+ id?: string;
992
+ builder?: string;
993
+ source?: SemaphorSourceRef | Record<string, unknown>;
994
+ sourceKey?: string;
995
+ valueFieldRef?: SemaphorDataAppCodegenFieldRef;
996
+ labelFieldRef?: SemaphorDataAppCodegenFieldRef;
997
+ filterFieldRef?: SemaphorDataAppCodegenFieldRef;
998
+ population?: Record<string, unknown>;
999
+ dependencies?: Record<string, unknown>;
1000
+ limit?: number;
1001
+ spec?: Record<string, unknown>;
1002
+ };
1003
+
1004
+ export declare type SemaphorDataAppCodegenSdkSpec = {
1005
+ builder: string;
1006
+ spec: Record<string, unknown>;
1007
+ };
1008
+
1009
+ export declare type SemaphorDataAppCodegenSummary = {
1010
+ schemaVersion: SemaphorDataAppCodegenSummarySchemaVersion;
1011
+ title: string;
1012
+ purpose?: string;
1013
+ userGoal?: string;
1014
+ nextStep?: string;
1015
+ sources: Array<SemaphorSourceRef | Record<string, unknown>>;
1016
+ inputs: SemaphorDataAppCodegenInput[];
1017
+ views: SemaphorDataAppCodegenView[];
1018
+ filterContracts: SemaphorDataAppFilterContract[];
1019
+ implementationChecklist: SemaphorDataAppImplementationChecklist;
1020
+ nextRequiredTool?: {
1021
+ name: string;
1022
+ reason?: string;
1023
+ };
1024
+ unsupportedInsights?: Array<Record<string, unknown>>;
1025
+ assumptions?: string[];
1026
+ validation?: Record<string, unknown>;
1027
+ };
1028
+
1029
+ export declare type SemaphorDataAppCodegenSummarySchemaVersion = typeof SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION;
1030
+
1031
+ export declare type SemaphorDataAppCodegenView = {
1032
+ id: string;
1033
+ title?: string;
1034
+ purpose?: string;
1035
+ visual?: string;
1036
+ visualSpec?: Record<string, unknown>;
1037
+ queryKind?: string;
1038
+ sdkBuilder?: string;
1039
+ sdkSpec?: SemaphorDataAppCodegenSdkSpec;
1040
+ fields?: SemaphorDataAppCodegenFieldRef[];
1041
+ computation?: Record<string, unknown>;
1042
+ };
1043
+
1044
+ export declare type SemaphorDataAppFilterContract = {
1045
+ inputId: string;
1046
+ label?: string;
1047
+ type?: string;
1048
+ serverSide?: boolean;
1049
+ fieldRef?: SemaphorDataAppCodegenFieldRef;
1050
+ optionQuery?: SemaphorDataAppCodegenInputOptionQuery;
1051
+ bindings: SemaphorDataAppFilterContractBinding[];
1052
+ appliesToViewIds: string[];
1053
+ notAppliedToViewIds: string[];
1054
+ };
1055
+
1056
+ export declare type SemaphorDataAppFilterContractBinding = {
1057
+ viewId: string;
1058
+ fieldRef: SemaphorDataAppCodegenFieldRef;
1059
+ relationshipHint?: SemaphorRelationshipHint;
1060
+ relationshipsUsed?: Array<Record<string, unknown>>;
1061
+ };
1062
+
1063
+ export declare type SemaphorDataAppImplementationChecklist = {
1064
+ schemaVersion?: string;
1065
+ requiredDevtools: {
1066
+ mountRootDevtools: boolean;
1067
+ providerDebugBridge?: string;
1068
+ panelPosition?: string;
1069
+ forbidden?: string[];
1070
+ };
1071
+ requiredInputOptions: Array<Record<string, unknown>>;
1072
+ filterScopeByInput: Array<Record<string, unknown>>;
1073
+ bindingsByView: Record<string, Array<Record<string, unknown>>>;
1074
+ validationCommands: string[];
1075
+ browserSmokeChecks: string[];
1076
+ };
1077
+
962
1078
  export declare type SemaphorDerivedFieldAggregationBehavior = 'additive' | 'non_additive' | 'ratio_of_sums' | 'weighted' | 'pre_aggregated' | 'snapshot';
963
1079
 
964
1080
  export declare type SemaphorDerivedFieldAggregationStrategy = 'default' | 'symmetric_aggregate' | 'aggregate_then_join' | 'weighted';
@@ -1639,6 +1755,11 @@ export declare function validateSemaphorAnalyticsRecoveryPlan(plan: SemaphorAnal
1639
1755
 
1640
1756
  export declare function validateSemaphorDashboardIntent(intent: SemaphorDashboardIntent): SemaphorValidationResult;
1641
1757
 
1758
+ export declare function validateSemaphorDataAppCodegenSummary(value: unknown): {
1759
+ ok: boolean;
1760
+ issues: string[];
1761
+ };
1762
+
1642
1763
  export declare function validateSemaphorDerivedFieldDefinition(definition: SemaphorDerivedFieldDefinition): SemaphorValidationResult;
1643
1764
 
1644
1765
  export declare function validateSemaphorOperationIntent(intent: SemaphorOperationIntent): SemaphorAnalyticsValidationResult;
@@ -705,6 +705,9 @@ export declare type SemaphorDataAppSourceHint = {
705
705
  export declare type SemaphorDataAppTrace = {
706
706
  traceId: string;
707
707
  viewId?: string;
708
+ viewTitle?: string;
709
+ visualType?: string;
710
+ sectionTitle?: string;
708
711
  queryId: string;
709
712
  queryLabel?: string;
710
713
  queryKind: SemaphorQueryDefinition['queryKind'];
@@ -1322,6 +1325,9 @@ declare type SemaphorProtocolVersion = 1;
1322
1325
 
1323
1326
  export declare type SemaphorQueryDebugOptions = {
1324
1327
  viewId?: string;
1328
+ viewTitle?: string;
1329
+ visualType?: string;
1330
+ sectionTitle?: string;
1325
1331
  title?: string;
1326
1332
  sourceHint?: SemaphorDataAppSourceHint;
1327
1333
  sourceHints?: SemaphorDataAppSourceHint[];
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.386",
8
+ "version": "0.1.388",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -9,6 +9,7 @@ patterns.
9
9
  ```tsx
10
10
  import {
11
11
  SemaphorDataAppProvider,
12
+ SemaphorDevtools,
12
13
  semaphor,
13
14
  useClearInvalidSemaphorInputValue,
14
15
  useSemaphorInputs,
@@ -23,6 +24,47 @@ import type {
23
24
  } from "react-semaphor/data-app-sdk";
24
25
  ```
25
26
 
27
+ ## Runtime Provider And DevTools
28
+
29
+ Generated local/dev apps should mount one root DevTools instance and enable the
30
+ debug bridge only outside production embeds.
31
+
32
+ ```tsx
33
+ const runtimeToken = import.meta.env.VITE_SEMAPHOR_PROJECT_TOKEN;
34
+ const enableDevtools =
35
+ import.meta.env.DEV ||
36
+ (typeof window !== "undefined" && window.location.hostname === "localhost");
37
+
38
+ export function Root() {
39
+ return (
40
+ <SemaphorDataAppProvider
41
+ token={runtimeToken}
42
+ debug={enableDevtools ? { exposeWindowBridge: true } : false}
43
+ >
44
+ <App />
45
+ <SemaphorDevtools
46
+ initialIsOpen={false}
47
+ buttonPosition="bottom-right"
48
+ panelPosition="right"
49
+ />
50
+ </SemaphorDataAppProvider>
51
+ );
52
+ }
53
+ ```
54
+
55
+ Add hook-level debug source hints when they are cheap and non-repetitive:
56
+
57
+ ```tsx
58
+ const result = useSemaphorQuery(revenueBySegment, {
59
+ debug: {
60
+ sourceHint: {
61
+ file: "src/views/RevenueBySegment.tsx",
62
+ component: "RevenueBySegment",
63
+ },
64
+ },
65
+ });
66
+ ```
67
+
26
68
  ## Source And Fields
27
69
 
28
70
  ```tsx
@@ -149,12 +191,37 @@ function SegmentFilter() {
149
191
  });
150
192
 
151
193
  useClearInvalidSemaphorInputValue(segmentHandle, optionsResult);
194
+
195
+ const selectedValue = Array.isArray(segmentHandle.value)
196
+ ? String(segmentHandle.value[0] ?? "")
197
+ : "";
198
+
199
+ return (
200
+ <select
201
+ value={selectedValue}
202
+ onChange={(event) => {
203
+ const nextValue = event.target.value || null;
204
+ segmentHandle.setValue(nextValue ? [nextValue] : undefined);
205
+ }}
206
+ >
207
+ <option value="">All segments</option>
208
+ {(optionsResult.options ?? []).map((option) => (
209
+ <option key={String(option.value)} value={String(option.value)}>
210
+ {option.label ?? String(option.value)}
211
+ </option>
212
+ ))}
213
+ </select>
214
+ );
152
215
  }
153
216
  ```
154
217
 
155
218
  Pass the full `optionsResult` to `useClearInvalidSemaphorInputValue`; do not
156
219
  pass only `optionsResult.options`, because idle/loading results can also expose
157
220
  an empty options array.
221
+ For shadcn/Base UI style selects, type the change callback as accepting
222
+ `string | null` and call `handle.clear()` or `handle.setValue(undefined)` for
223
+ the empty state. For multi-selects and date ranges, narrow `handle.value` with
224
+ `Array.isArray(...)` before indexing or displaying it.
158
225
 
159
226
  ## Shared Inputs With Source-Specific Bindings
160
227