react-semaphor 0.1.380 → 0.1.382

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/DATA_APP_SDK.md +238 -0
  2. package/README.md +7 -0
  3. package/dist/analytics-protocol/index.cjs +1 -1
  4. package/dist/analytics-protocol/index.js +45 -41
  5. package/dist/brand-studio/index.cjs +1 -1
  6. package/dist/brand-studio/index.js +6 -6
  7. package/dist/chunks/analyze-result-contract-CtXfp3nv.js +1 -0
  8. package/dist/chunks/analyze-result-contract-DuhlklhI.js +102 -0
  9. package/dist/chunks/{braces-BT-ZyB-g.js → braces-CGi-YFZp.js} +1 -1
  10. package/dist/chunks/{braces-DOxxfERN.js → braces-CP8BEzl3.js} +1 -1
  11. package/dist/chunks/{calendar-preferences-dialog-Dsgs8WDv.js → calendar-preferences-dialog-CV4xF2Tp.js} +3 -3
  12. package/dist/chunks/{calendar-preferences-dialog-iZs8XqyH.js → calendar-preferences-dialog-rDDobeLo.js} +1 -1
  13. package/dist/chunks/catalog-field-grounding-Bnx-3tE0.js +1 -0
  14. package/dist/chunks/catalog-field-grounding-CJKAqtiC.js +100 -0
  15. package/dist/chunks/{dashboard-briefing-launcher-Coks66cV.js → dashboard-briefing-launcher-BT00MvGB.js} +5 -5
  16. package/dist/chunks/{dashboard-briefing-launcher-B5vPTl8P.js → dashboard-briefing-launcher-Dcbh-mjY.js} +1 -1
  17. package/dist/chunks/{dashboard-controls-BfkcnIdy.js → dashboard-controls-B6y7jkKO.js} +8 -8
  18. package/dist/chunks/{dashboard-controls-Dyqye6fh.js → dashboard-controls-CRqnPibB.js} +1 -1
  19. package/dist/chunks/{dashboard-json-DjXi4cI6.js → dashboard-json-CfIUG8k1.js} +3 -3
  20. package/dist/chunks/{dashboard-json-CV_LnO9x.js → dashboard-json-DEQqRR1x.js} +1 -1
  21. package/dist/chunks/{edit-dashboard-visual-DOW1Ap1N.js → edit-dashboard-visual-DMbf89xa.js} +5 -5
  22. package/dist/chunks/{edit-dashboard-visual-yinO0yU-.js → edit-dashboard-visual-wDOcHak3.js} +1 -1
  23. package/dist/chunks/{index-DlprYjr6.js → index-BAsWLkZ8.js} +169 -168
  24. package/dist/chunks/{index-CkoRCh3g.js → index-CrKxP9uF.js} +5 -5
  25. package/dist/chunks/{layout-grid-DTbOIOsE.js → layout-grid-BsKH3TgY.js} +1 -1
  26. package/dist/chunks/{layout-grid-DccceHv4.js → layout-grid-jJQUqDN9.js} +1 -1
  27. package/dist/chunks/operators-C8TxpM4C.js +48 -0
  28. package/dist/chunks/operators-DrTQsJXv.js +1 -0
  29. package/dist/chunks/{palette-SimHJELn.js → palette-9zLPGlj2.js} +1 -1
  30. package/dist/chunks/{palette-DCzLwqIw.js → palette-xU9Qt6bE.js} +1 -1
  31. package/dist/chunks/{save-D2O96E5A.js → save-8A_q6K4E.js} +1 -1
  32. package/dist/chunks/{save-zNVYH02T.js → save-DzciESDh.js} +1 -1
  33. package/dist/chunks/{source-identity-Dj3dryN9.js → source-identity-CN4xiyKJ.js} +5 -5
  34. package/dist/chunks/{switch-DMPsMpHW.js → switch-DArtNJZh.js} +292 -291
  35. package/dist/chunks/{switch-Jhyl63RF.js → switch-k7kj6NRg.js} +1 -1
  36. package/dist/chunks/{use-create-flow-overlay-state-r5JKyXU8.js → use-create-flow-overlay-state-BdG1DiSx.js} +4 -4
  37. package/dist/chunks/{use-create-flow-overlay-state-NsqFPwdB.js → use-create-flow-overlay-state-ipeaE65_.js} +1 -1
  38. package/dist/chunks/{validators-CtNmgsvG.js → validators-CHPH6ORs.js} +641 -498
  39. package/dist/chunks/validators-lWo8m0Q7.js +1 -0
  40. package/dist/dashboard/index.cjs +1 -1
  41. package/dist/dashboard/index.js +1 -1
  42. package/dist/dashboard-authoring/index.cjs +3 -3
  43. package/dist/dashboard-authoring/index.js +105 -92
  44. package/dist/data-app-builder/index.cjs +1 -1
  45. package/dist/data-app-builder/index.js +3 -3
  46. package/dist/data-app-sdk/index.cjs +1 -1
  47. package/dist/data-app-sdk/index.js +444 -380
  48. package/dist/data-app-sdk-adapters/index.cjs +1 -0
  49. package/dist/data-app-sdk-adapters/index.js +383 -0
  50. package/dist/data-app-sdk-validation/index.cjs +1 -1
  51. package/dist/data-app-sdk-validation/index.js +1073 -6
  52. package/dist/index.cjs +1 -1
  53. package/dist/index.js +7 -7
  54. package/dist/surfboard/index.cjs +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/analytics-protocol.d.ts +58 -31
  57. package/dist/types/dashboard-assistant.d.ts +40 -15
  58. package/dist/types/dashboard-authoring.d.ts +36 -16
  59. package/dist/types/dashboard.d.ts +8 -8
  60. package/dist/types/data-app-builder.d.ts +35 -11
  61. package/dist/types/data-app-sdk-adapters.d.ts +733 -0
  62. package/dist/types/data-app-sdk-validation.d.ts +85 -25
  63. package/dist/types/data-app-sdk.d.ts +99 -155
  64. package/dist/types/main.d.ts +35 -11
  65. package/dist/types/shared.d.ts +8 -8
  66. package/dist/types/surfboard.d.ts +8 -8
  67. package/dist/types/types.d.ts +8 -8
  68. package/package.json +9 -2
  69. package/src/data-app-sdk/README.md +240 -0
  70. package/dist/chunks/catalog-field-grounding-8L9I0zdg.js +0 -1
  71. package/dist/chunks/catalog-field-grounding-BK4BX8sZ.js +0 -200
  72. package/dist/chunks/validation-BM3-ShHV.js +0 -1003
  73. package/dist/chunks/validation-BVpqRFar.js +0 -1
  74. package/dist/chunks/validators-jpoYhpHh.js +0 -1
@@ -0,0 +1,238 @@
1
+ # Data App SDK Quick Reference
2
+
3
+ Use this as the public package quick reference for Semaphor Data Apps. Prefer
4
+ these patterns over inspecting `dist/types` or SDK implementation files.
5
+
6
+ ## Imports
7
+
8
+ ```tsx
9
+ import {
10
+ SemaphorDataAppProvider,
11
+ semaphor,
12
+ useClearInvalidSemaphorInputValue,
13
+ useSemaphorInput,
14
+ useSemaphorInputs,
15
+ useSemaphorQuery,
16
+ } from "react-semaphor/data-app-sdk";
17
+
18
+ import type {
19
+ SemaphorMetricQueryResult,
20
+ SemaphorRecordsField,
21
+ SemaphorRecordsQueryResult,
22
+ SemaphorSourceRef,
23
+ } from "react-semaphor/data-app-sdk";
24
+ ```
25
+
26
+ ## Source And Fields
27
+
28
+ ```tsx
29
+ const orders = semaphor.source.semantic({
30
+ domainId: "sales",
31
+ datasetName: "orders",
32
+ datasetId: "sales.orders",
33
+ }) satisfies SemaphorSourceRef;
34
+
35
+ const revenue = semaphor.field.measure("revenue", {
36
+ label: "Revenue",
37
+ dataType: "number",
38
+ aggregate: "SUM",
39
+ source: orders,
40
+ }) satisfies SemaphorRecordsField;
41
+
42
+ const segment = semaphor.field.dimension("segment", {
43
+ label: "Segment",
44
+ dataType: "string",
45
+ source: orders,
46
+ }) satisfies SemaphorRecordsField;
47
+
48
+ const orderDate = semaphor.field.date("order_date", {
49
+ label: "Order Date",
50
+ dataType: "date",
51
+ source: orders,
52
+ });
53
+ ```
54
+
55
+ ## Metric
56
+
57
+ ```tsx
58
+ const revenueKpi = semaphor.metric({
59
+ id: "revenue-kpi",
60
+ source: orders,
61
+ measures: [revenue],
62
+ primaryMeasure: revenue,
63
+ dateField: orderDate,
64
+ });
65
+
66
+ const result = useSemaphorQuery(revenueKpi);
67
+ ```
68
+
69
+ ## Records
70
+
71
+ ```tsx
72
+ const revenueBySegment = semaphor.records({
73
+ id: "revenue-by-segment",
74
+ source: orders,
75
+ fields: [segment, revenue],
76
+ dateField: orderDate,
77
+ orderBy: { field: revenue, direction: "desc" },
78
+ limit: 10,
79
+ });
80
+
81
+ const result = useSemaphorQuery(revenueBySegment);
82
+ ```
83
+
84
+ ## Row Access
85
+
86
+ Read row values with `columns[].key`; display `columns[].label`.
87
+
88
+ ```tsx
89
+ function RecordsTable({ result }: { result: SemaphorRecordsQueryResult }) {
90
+ const records = result.records ?? [];
91
+ const columns = result.columns ?? [];
92
+
93
+ return (
94
+ <table>
95
+ <thead>
96
+ <tr>
97
+ {columns.map((column) => (
98
+ <th key={column.key}>{column.label || column.name}</th>
99
+ ))}
100
+ </tr>
101
+ </thead>
102
+ <tbody>
103
+ {records.map((row, rowIndex) => (
104
+ <tr key={rowIndex}>
105
+ {columns.map((column) => (
106
+ <td key={column.key}>{String(row[column.key] ?? "")}</td>
107
+ ))}
108
+ </tr>
109
+ ))}
110
+ </tbody>
111
+ </table>
112
+ );
113
+ }
114
+ ```
115
+
116
+ ## Input Options
117
+
118
+ ```tsx
119
+ const segmentFilter = semaphor.filter({
120
+ id: "segment",
121
+ label: "Segment",
122
+ field: segment,
123
+ operator: "in",
124
+ });
125
+
126
+ const segmentOptions = semaphor.inputOptions({
127
+ id: "segment-options",
128
+ inputId: "segment",
129
+ source: orders,
130
+ labelField: segment,
131
+ valueField: segment,
132
+ dependencies: { mode: "auto" },
133
+ limit: 100,
134
+ });
135
+
136
+ function SegmentFilter() {
137
+ const segmentHandle = useSemaphorInput(segmentFilter);
138
+ const optionsResult = useSemaphorQuery(segmentOptions, {
139
+ inputs: [segmentHandle],
140
+ });
141
+
142
+ useClearInvalidSemaphorInputValue(segmentHandle, optionsResult);
143
+ }
144
+ ```
145
+
146
+ Pass the full options query result to `useClearInvalidSemaphorInputValue`.
147
+ Do not pass only `optionsResult.options`, because idle/loading results can also
148
+ expose an empty options array.
149
+
150
+ ## Shared Inputs With Source-Specific Bindings
151
+
152
+ Use `semaphor.bindInput(...)` when one visible input maps to different query
153
+ fields.
154
+
155
+ ```tsx
156
+ const dateRange = semaphor.filter({
157
+ id: "date_range",
158
+ label: "Date Range",
159
+ field: orderDate,
160
+ operator: "between",
161
+ });
162
+
163
+ function Dashboard() {
164
+ const dateRangeHandle = useSemaphorInput(dateRange);
165
+
166
+ const ordersResult = useSemaphorQuery(ordersQuery, {
167
+ inputs: [semaphor.bindInput(dateRangeHandle, { field: orderDate })],
168
+ });
169
+ const invoicesResult = useSemaphorQuery(invoicesQuery, {
170
+ inputs: [semaphor.bindInput(dateRangeHandle, { field: invoiceDate })],
171
+ });
172
+
173
+ const range = Array.isArray(dateRangeHandle.value)
174
+ ? dateRangeHandle.value
175
+ : [];
176
+ }
177
+ ```
178
+
179
+ ## Related Dimension Filters
180
+
181
+ Use a human-readable related dimension as the visible filter and preserve the
182
+ relationship hint for each fact query.
183
+
184
+ ```tsx
185
+ const material = semaphor.source.semantic({
186
+ domainId: "ops",
187
+ datasetName: "dim_material",
188
+ });
189
+
190
+ const materialFamily = semaphor.field.dimension("material_family", {
191
+ label: "Material Family",
192
+ dataType: "string",
193
+ source: material,
194
+ });
195
+
196
+ const materialFamilyFilter = semaphor.filter<string[]>({
197
+ id: "material_family",
198
+ label: "Material Family",
199
+ field: materialFamily,
200
+ operator: "in",
201
+ multi: true,
202
+ });
203
+
204
+ const materialOptions = semaphor.inputOptions({
205
+ id: "material-family-options",
206
+ inputId: "material_family",
207
+ source: material,
208
+ labelField: materialFamily,
209
+ valueField: materialFamily,
210
+ limit: 100,
211
+ });
212
+
213
+ function OpsViews() {
214
+ const materialHandle = useSemaphorInput(materialFamilyFilter);
215
+ useSemaphorQuery(materialOptions);
216
+
217
+ const purchase = useSemaphorQuery(purchaseQuery, {
218
+ inputs: [
219
+ semaphor.bindInput(materialHandle, {
220
+ field: materialFamily,
221
+ relationshipHint: { relationshipIds: ["purchase_material"] },
222
+ }),
223
+ ],
224
+ });
225
+
226
+ const sales = useSemaphorQuery(salesQuery, {
227
+ inputs: [
228
+ semaphor.bindInput(materialHandle, {
229
+ field: materialFamily,
230
+ relationshipHint: { relationshipIds: ["sales_material"] },
231
+ }),
232
+ ],
233
+ });
234
+ }
235
+ ```
236
+
237
+ The query result should remain governed by Semaphor. Do not fetch broad rows and
238
+ filter or join them in React to simulate related-dimension behavior.
package/README.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Data App SDK
2
+
3
+ For agent-built or custom React data apps, use the public Data App SDK quick
4
+ reference in [`DATA_APP_SDK.md`](./DATA_APP_SDK.md). It covers governed
5
+ `metric` and `records` queries, shared inputs, `inputOptions`, relationship
6
+ hints, and row access through `columns[].key`.
7
+
1
8
  Integrating dashboard into your React app is a straightforward three-step process.
2
9
 
3
10
  ### **1) Install Semaphor Package**
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../chunks/validators-jpoYhpHh.js"),r=require("../chunks/catalog-field-grounding-8L9I0zdg.js"),l=require("../chunks/source-identity-C-xaeE_I.js");function c(e,a={}){const i=d(e),s={connectionId:a.connectionId,connectionType:e,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return i.includes("postgres")?{...s,prefixLevels:["schema","table"],dialect:"postgres"}:i.includes("mysql")?{...s,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:i.includes("mssql")||i.includes("sqlserver")?{...s,dialect:"mssql",supportsFilterClause:!1}:i.includes("redshift")?{...s,prefixLevels:["schema","table"],dialect:"redshift"}:i.includes("snowflake")?{...s,dialect:"snowflake"}:i.includes("clickhouse")?{connectionId:a.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:i==="s3"||i==="api"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:i==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:i==="googlesheets"||i==="fileupload"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:i==="s3tables"?{...s,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:i==="bigquery"?{...s,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:s}function u(e){const a=d(e);switch(a){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return a;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function m(e){return e.capabilities.prefixLevels.every(a=>!!o(e.source,a))}function p(e){const a=e.quoteIdentifier??b;return e.capabilities.prefixLevels.map(i=>o(e.source,i)).filter(i=>!!i).map(i=>a(i,e.capabilities.dialect)).join(".")}function o(e,a){return a==="database"?e.databaseName:a==="schema"?e.schemaName:e.tableName}function b(e,a){return a==="mysql"||a==="bigquery"||a==="clickhouse"||a==="duckdb"?`\`${e.replace(/`/g,"``")}\``:a==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function d(e){if(typeof e!="string")return"";const a=[];for(const i of e.trim().toLowerCase())h(i)&&a.push(i);return a.join("")}function h(e){const a=e.charCodeAt(0);return a>=48&&a<=57||a>=97&&a<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},f={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:n,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:n,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",source:n,field:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:n,metrics:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMetric:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=t.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=t.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=t.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=t.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=t.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=t.validateSemaphorDashboardIntent;exports.validateSemaphorDerivedFieldDefinition=t.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=t.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=t.validateSemaphorResultCalculation;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=r.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.buildAnalyticsCatalogFieldSummary=r.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=r.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=r.getAnalyticsCatalogFieldName;exports.getSemaphorAnalyzeResultFieldNames=r.getSemaphorAnalyzeResultFieldNames;exports.isAnalyticsCatalogDateField=r.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=r.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=r.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=r.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=r.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=r.isAnalyticsTechnicalIdentifierField;exports.isSemaphorAnalyzeResultFieldName=r.isSemaphorAnalyzeResultFieldName;exports.normalizeAnalyticsCatalogDataType=r.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=r.normalizeAnalyticsCatalogName;exports.parseSemaphorAnalyzeResult=r.parseSemaphorAnalyzeResult;exports.preferSemaphorFieldRefMetadata=l.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=l.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=l.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=l.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=l.semaphorSourcesReferToSameDataset;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=f;exports.buildSemaphorQualifiedSourcePath=p;exports.getSemaphorConnectionCapabilities=c;exports.normalizeSemaphorDialect=u;exports.semaphorSourceHasRequiredCoordinates=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../chunks/operators-DrTQsJXv.js"),s=require("../chunks/validators-lWo8m0Q7.js"),o=require("../chunks/analyze-result-contract-CtXfp3nv.js"),i=require("../chunks/catalog-field-grounding-Bnx-3tE0.js"),l=require("../chunks/source-identity-C-xaeE_I.js");function m(e,a={}){const r=c(e),t={connectionId:a.connectionId,connectionType:e,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return r.includes("postgres")?{...t,prefixLevels:["schema","table"],dialect:"postgres"}:r.includes("mysql")?{...t,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:r.includes("mssql")||r.includes("sqlserver")?{...t,dialect:"mssql",supportsFilterClause:!1}:r.includes("redshift")?{...t,prefixLevels:["schema","table"],dialect:"redshift"}:r.includes("snowflake")?{...t,dialect:"snowflake"}:r.includes("clickhouse")?{connectionId:a.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:r==="s3"||r==="api"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:r==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:r==="googlesheets"||r==="fileupload"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:r==="s3tables"?{...t,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:r==="bigquery"?{...t,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:t}function p(e){const a=c(e);switch(a){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return a;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function b(e){return e.capabilities.prefixLevels.every(a=>!!u(e.source,a))}function h(e){const a=e.quoteIdentifier??f;return e.capabilities.prefixLevels.map(r=>u(e.source,r)).filter(r=>!!r).map(r=>a(r,e.capabilities.dialect)).join(".")}function u(e,a){return a==="database"?e.databaseName:a==="schema"?e.schemaName:e.tableName}function f(e,a){return a==="mysql"||a==="bigquery"||a==="clickhouse"||a==="duckdb"?`\`${e.replace(/`/g,"``")}\``:a==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function c(e){if(typeof e!="string")return"";const a=[];for(const r of e.trim().toLowerCase())y(r)&&a.push(r);return a.join("")}function y(e){const a=e.charCodeAt(0);return a>=48&&a<=57||a>=97&&a<=122}const n={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},S={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:n,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:n,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",inputId:"region",source:n,labelField:{name:"region",role:"dimension",dataType:"string"},valueField:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:n,measures:[{name:"revenue",role:"measure"}],primaryMeasure:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:n,measures:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMeasure:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=d.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=d.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=s.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=s.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=s.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=s.validateSemaphorDashboardIntent;exports.validateSemaphorDerivedFieldDefinition=s.validateSemaphorDerivedFieldDefinition;exports.validateSemaphorOperationIntent=s.validateSemaphorOperationIntent;exports.validateSemaphorResultCalculation=s.validateSemaphorResultCalculation;exports.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT=o.SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;exports.getSemaphorAnalyzeResultFieldNames=o.getSemaphorAnalyzeResultFieldNames;exports.isSemaphorAnalyzeResultFieldName=o.isSemaphorAnalyzeResultFieldName;exports.parseSemaphorAnalyzeResult=o.parseSemaphorAnalyzeResult;exports.buildAnalyticsCatalogFieldSummary=i.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=i.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=i.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=i.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=i.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=i.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=i.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=i.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=i.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=i.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=i.normalizeAnalyticsCatalogName;exports.preferSemaphorFieldRefMetadata=l.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=l.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=l.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=l.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=l.semaphorSourcesReferToSameDataset;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=S;exports.buildSemaphorQualifiedSourcePath=h;exports.getSemaphorConnectionCapabilities=m;exports.normalizeSemaphorDialect=p;exports.semaphorSourceHasRequiredCoordinates=b;
@@ -1,6 +1,8 @@
1
- import { a as h, n as v, p as g, c as y, e as S, f as k, v as C, d as T, b as I } from "../chunks/validators-CtNmgsvG.js";
2
- import { S as F, l as q, b as R, a as _, g as L, e as D, k as N, j as x, d as M, h as O, f as z, i as E, c as w, n as P, p as B } from "../chunks/catalog-field-grounding-BK4BX8sZ.js";
3
- import { c as Q, p as U, b as Y, s as G, a as H } from "../chunks/source-identity-Dj3dryN9.js";
1
+ import { a as h, n as v } from "../chunks/operators-C8TxpM4C.js";
2
+ import { p as y, b as S, d as T, e as C, v as I, c as k, a as F } from "../chunks/validators-CHPH6ORs.js";
3
+ import { S as q, g as R, i as _, p as L } from "../chunks/analyze-result-contract-DuhlklhI.js";
4
+ import { j as x, a as N, g as M, c as O, h as z, f as E, i as w, e as P, d as B, b as j, n as Q } from "../chunks/catalog-field-grounding-CJKAqtiC.js";
5
+ import { p as Y, c as G, s as H, a as $, b as K } from "../chunks/source-identity-CN4xiyKJ.js";
4
6
  function d(e, a = {}) {
5
7
  const r = n(e), s = {
6
8
  connectionId: a.connectionId,
@@ -86,7 +88,7 @@ function d(e, a = {}) {
86
88
  supportsFilterClause: !1
87
89
  } : s;
88
90
  }
89
- function c(e) {
91
+ function u(e) {
90
92
  const a = n(e);
91
93
  switch (a) {
92
94
  case "mysql":
@@ -107,7 +109,7 @@ function c(e) {
107
109
  return "unknown";
108
110
  }
109
111
  }
110
- function u(e) {
112
+ function c(e) {
111
113
  return e.capabilities.prefixLevels.every(
112
114
  (a) => !!t(e.source, a)
113
115
  );
@@ -147,8 +149,8 @@ const i = {
147
149
  id: "revenue-kpi",
148
150
  label: "Revenue",
149
151
  source: i,
150
- metrics: [{ name: "revenue", role: "measure" }],
151
- primaryMetric: { name: "revenue", role: "measure" },
152
+ measures: [{ name: "revenue", role: "measure" }],
153
+ primaryMeasure: { name: "revenue", role: "measure" },
152
154
  comparison: { kind: "previous_period" },
153
155
  limit: 1
154
156
  },
@@ -185,8 +187,10 @@ const i = {
185
187
  kind: "inputOptions",
186
188
  id: "region-options",
187
189
  label: "Region options",
190
+ inputId: "region",
188
191
  source: i,
189
- field: { name: "region", role: "dimension", dataType: "string" },
192
+ labelField: { name: "region", role: "dimension", dataType: "string" },
193
+ valueField: { name: "region", role: "dimension", dataType: "string" },
190
194
  limit: 100
191
195
  },
192
196
  previousPeriodRevenueComparison: {
@@ -195,8 +199,8 @@ const i = {
195
199
  id: "revenue-previous-period",
196
200
  label: "Revenue previous period comparison",
197
201
  source: i,
198
- metrics: [{ name: "revenue", role: "measure" }],
199
- primaryMetric: { name: "revenue", role: "measure" },
202
+ measures: [{ name: "revenue", role: "measure" }],
203
+ primaryMeasure: { name: "revenue", role: "measure" },
200
204
  dateField: { name: "order_date", role: "date", dataType: "date" },
201
205
  timeGrain: "week",
202
206
  comparison: { kind: "previous_period" },
@@ -208,11 +212,11 @@ const i = {
208
212
  id: "inbound-supplier-concentration",
209
213
  label: "Inbound supplier concentration",
210
214
  source: i,
211
- metrics: [
215
+ measures: [
212
216
  { name: "net_tons", role: "measure" },
213
217
  { name: "ticket_value", role: "measure" }
214
218
  ],
215
- primaryMetric: { name: "net_tons", role: "measure" },
219
+ primaryMeasure: { name: "net_tons", role: "measure" },
216
220
  dateField: { name: "ticket_date", role: "date", dataType: "date" },
217
221
  timeWindow: { unit: "month", value: 6, anchor: "latest_available" },
218
222
  dimensions: [{ name: "supplier_id", role: "dimension", dataType: "number" }],
@@ -246,37 +250,37 @@ const i = {
246
250
  };
247
251
  export {
248
252
  p as SEMAPHOR_ANALYTICS_INTENT_FIXTURES,
249
- F as SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT,
250
- q as buildAnalyticsCatalogFieldSummary,
253
+ q as SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT,
254
+ x as buildAnalyticsCatalogFieldSummary,
251
255
  m as buildSemaphorQualifiedSourcePath,
252
- R as getAnalyticsCatalogFieldCandidates,
253
- _ as getAnalyticsCatalogFieldName,
254
- L as getSemaphorAnalyzeResultFieldNames,
256
+ N as getAnalyticsCatalogFieldCandidates,
257
+ M as getAnalyticsCatalogFieldName,
258
+ R as getSemaphorAnalyzeResultFieldNames,
255
259
  d as getSemaphorConnectionCapabilities,
256
- D as isAnalyticsCatalogDateField,
257
- N as isAnalyticsCatalogDimensionField,
258
- x as isAnalyticsCatalogMetricField,
259
- M as isAnalyticsDateLikeDataType,
260
- O as isAnalyticsMetricIdentifierField,
261
- z as isAnalyticsTechnicalIdentifierField,
262
- E as isSemaphorAnalyzeResultFieldName,
263
- w as normalizeAnalyticsCatalogDataType,
264
- P as normalizeAnalyticsCatalogName,
260
+ O as isAnalyticsCatalogDateField,
261
+ z as isAnalyticsCatalogDimensionField,
262
+ E as isAnalyticsCatalogMetricField,
263
+ w as isAnalyticsDateLikeDataType,
264
+ P as isAnalyticsMetricIdentifierField,
265
+ B as isAnalyticsTechnicalIdentifierField,
266
+ _ as isSemaphorAnalyzeResultFieldName,
267
+ j as normalizeAnalyticsCatalogDataType,
268
+ Q as normalizeAnalyticsCatalogName,
265
269
  h as normalizeSemaphorAnalyticsFilterOperator,
266
- c as normalizeSemaphorDialect,
270
+ u as normalizeSemaphorDialect,
267
271
  v as normalizeSemaphorInputOperator,
268
- B as parseSemaphorAnalyzeResult,
269
- g as parseSemaphorIsoTimeWindowBoundary,
270
- Q as preferSemaphorFieldRefMetadata,
271
- U as preferSemaphorSourceMetadata,
272
- Y as semaphorFieldRefsMatch,
273
- u as semaphorSourceHasRequiredCoordinates,
274
- G as semaphorSourceIdentityKey,
275
- H as semaphorSourcesReferToSameDataset,
276
- y as validateSemaphorAnalyticsIntent,
277
- S as validateSemaphorAnalyticsRecoveryPlan,
278
- k as validateSemaphorDashboardIntent,
279
- C as validateSemaphorDerivedFieldDefinition,
280
- T as validateSemaphorOperationIntent,
281
- I as validateSemaphorResultCalculation
272
+ L as parseSemaphorAnalyzeResult,
273
+ y as parseSemaphorIsoTimeWindowBoundary,
274
+ Y as preferSemaphorFieldRefMetadata,
275
+ G as preferSemaphorSourceMetadata,
276
+ H as semaphorFieldRefsMatch,
277
+ c as semaphorSourceHasRequiredCoordinates,
278
+ $ as semaphorSourceIdentityKey,
279
+ K as semaphorSourcesReferToSameDataset,
280
+ S as validateSemaphorAnalyticsIntent,
281
+ T as validateSemaphorAnalyticsRecoveryPlan,
282
+ C as validateSemaphorDashboardIntent,
283
+ I as validateSemaphorDerivedFieldDefinition,
284
+ k as validateSemaphorOperationIntent,
285
+ F as validateSemaphorResultCalculation
282
286
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-Jhyl63RF.js"),A=require("../chunks/index-DRlMUglg.js");require("../chunks/index-BxM99sFL.js");require("../chunks/catalog-field-grounding-8L9I0zdg.js");const V=require("../chunks/palette-SimHJELn.js"),ge=require("../chunks/braces-BT-ZyB-g.js"),be=require("../chunks/save-D2O96E5A.js"),fe=require("../chunks/layout-grid-DccceHv4.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-k7kj6NRg.js"),A=require("../chunks/index-DRlMUglg.js");require("../chunks/index-BxM99sFL.js");require("../chunks/analyze-result-contract-CtXfp3nv.js");const V=require("../chunks/palette-9zLPGlj2.js"),ge=require("../chunks/braces-CGi-YFZp.js"),be=require("../chunks/save-8A_q6K4E.js"),fe=require("../chunks/layout-grid-jJQUqDN9.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,13 +1,13 @@
1
1
  import { jsxs as d, jsx as r, Fragment as ce } from "react/jsx-runtime";
2
2
  import m from "react";
3
- import { c as ae, a as q, P as ge, b as be, B as C, d as fe, U as De, C as Ie, R as me, f as le, X as Je, S as se, e as je, T as Le, I as $e, J as U, K as _e, M, N as Ve, O as Ue, Q as Me, V as Ge, L as E, W as K, Y as Q, Z as ee, _ as he, $ as re, a0 as oe, a1 as ke, a2 as xe, a3 as ye, a4 as ve, a5 as Ce, a6 as We } from "../chunks/switch-DMPsMpHW.js";
3
+ import { c as ae, a as q, P as ge, b as be, B as C, d as fe, U as De, C as Ie, R as me, f as le, X as Je, S as se, e as je, T as Le, I as $e, J as U, K as _e, M, N as Ve, O as Ue, Q as Me, V as Ge, L as E, W as K, Y as Q, Z as ee, _ as he, $ as re, a0 as oe, a1 as ke, a2 as xe, a3 as ye, a4 as ve, a5 as Ce, a6 as We } from "../chunks/switch-DArtNJZh.js";
4
4
  import { r as He, v as Ye, A as Xe, a as Ze, p as qe } from "../chunks/index-CJdxSyQq.js";
5
5
  import "../chunks/index-CuHybtft.js";
6
- import "../chunks/catalog-field-grounding-BK4BX8sZ.js";
7
- import { P as G } from "../chunks/palette-DCzLwqIw.js";
8
- import { B as Ke } from "../chunks/braces-DOxxfERN.js";
9
- import { S as Qe } from "../chunks/save-zNVYH02T.js";
10
- import { L as er } from "../chunks/layout-grid-DTbOIOsE.js";
6
+ import "../chunks/analyze-result-contract-DuhlklhI.js";
7
+ import { P as G } from "../chunks/palette-xU9Qt6bE.js";
8
+ import { B as Ke } from "../chunks/braces-CP8BEzl3.js";
9
+ import { S as Qe } from "../chunks/save-DzciESDh.js";
10
+ import { L as er } from "../chunks/layout-grid-BsKH3TgY.js";
11
11
  /**
12
12
  * @license lucide-react v0.453.0 - ISC
13
13
  *
@@ -0,0 +1 @@
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;
@@ -0,0 +1,102 @@
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
+ };
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./switch-Jhyl63RF.js");/**
1
+ "use strict";const e=require("./switch-k7kj6NRg.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import { c as a } from "./switch-DMPsMpHW.js";
1
+ import { c as a } from "./switch-DArtNJZh.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -1,9 +1,9 @@
1
1
  import { jsx as r, jsxs as s, Fragment as X } from "react/jsx-runtime";
2
2
  import ee, { useState as h, useCallback as F, useEffect as ae, useMemo as H } from "react";
3
- import { u as re, b as te, c as se, d as ne, e as le, f as oe, R as W, g as O, C as ie, h as ce, i as de, j as ue, k as me, l as _, m as R, n as fe, o as he, p as N } from "./index-DlprYjr6.js";
4
- import { a as S, L as G, P as pe, b as ge, B as j, d as ve, e as V, f as be } from "./switch-DMPsMpHW.js";
3
+ import { u as re, b as te, c as se, d as ne, e as le, f as oe, R as W, g as O, C as ie, h as ce, i as de, j as ue, k as me, l as _, m as R, n as fe, o as he, p as N } from "./index-BAsWLkZ8.js";
4
+ import { a as S, L as G, P as pe, b as ge, B as j, d as ve, e as V, f as be } from "./switch-DArtNJZh.js";
5
5
  import "./index-CuHybtft.js";
6
- import "./catalog-field-grounding-BK4BX8sZ.js";
6
+ import "./analyze-result-contract-DuhlklhI.js";
7
7
  function we(n = {}) {
8
8
  var C, A, E, L;
9
9
  const { authToken: c, tokenProps: e } = re(), p = n.enabled ?? !0, d = (c == null ? void 0 : c.accessToken) ?? null, u = (e == null ? void 0 : e.apiServiceUrl) ?? null, [I, k] = h(!1), [y, b] = h(!1), [m, g] = h(!1), [T, o] = h(null), [v, w] = h(null), P = v || {