@burdenoff/microfe-semanticfed 2026.1109.13 → 2026.1109.15

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 (82) hide show
  1. package/dist/semanticfed/components/AskQuestionPanel.d.ts +0 -14
  2. package/dist/semanticfed/components/AskQuestionPanel.js +198 -160
  3. package/dist/semanticfed/components/AskQuestionPanel.js.map +1 -1
  4. package/dist/semanticfed/components/OnboardingChecklist.js +172 -128
  5. package/dist/semanticfed/components/OnboardingChecklist.js.map +1 -1
  6. package/dist/semanticfed/components/PageHeader.d.ts +11 -0
  7. package/dist/semanticfed/components/PageHeader.js +21 -0
  8. package/dist/semanticfed/components/PageHeader.js.map +1 -0
  9. package/dist/semanticfed/components/SavedQueryRunsPanel.js +217 -193
  10. package/dist/semanticfed/components/SavedQueryRunsPanel.js.map +1 -1
  11. package/dist/semanticfed/components/SummaryCard.d.ts +10 -0
  12. package/dist/semanticfed/components/SummaryCard.js +21 -0
  13. package/dist/semanticfed/components/SummaryCard.js.map +1 -0
  14. package/dist/semanticfed/components/TableHeaders.d.ts +16 -0
  15. package/dist/semanticfed/components/TableHeaders.js +21 -0
  16. package/dist/semanticfed/components/TableHeaders.js.map +1 -0
  17. package/dist/semanticfed/components/askConversation.d.ts +16 -0
  18. package/dist/semanticfed/components/askConversation.js +7 -0
  19. package/dist/semanticfed/components/askConversation.js.map +1 -0
  20. package/dist/semanticfed/components/lineage/LineageDetails.d.ts +14 -0
  21. package/dist/semanticfed/components/lineage/LineageDetails.js +151 -0
  22. package/dist/semanticfed/components/lineage/LineageDetails.js.map +1 -0
  23. package/dist/semanticfed/components/lineage/LineageLanes.d.ts +11 -0
  24. package/dist/semanticfed/components/lineage/LineageLanes.js +78 -0
  25. package/dist/semanticfed/components/lineage/LineageLanes.js.map +1 -0
  26. package/dist/semanticfed/components/lineage/LineageToolbar.d.ts +14 -0
  27. package/dist/semanticfed/components/lineage/LineageToolbar.js +69 -0
  28. package/dist/semanticfed/components/lineage/LineageToolbar.js.map +1 -0
  29. package/dist/semanticfed/components/lineage/LineageWarnings.d.ts +13 -0
  30. package/dist/semanticfed/components/lineage/LineageWarnings.js +43 -0
  31. package/dist/semanticfed/components/lineage/LineageWarnings.js.map +1 -0
  32. package/dist/semanticfed/components/lineage/lineageModel.d.ts +26 -0
  33. package/dist/semanticfed/components/lineage/lineageModel.js +104 -0
  34. package/dist/semanticfed/components/lineage/lineageModel.js.map +1 -0
  35. package/dist/semanticfed/components/lineage/useLineageTrace.d.ts +17 -0
  36. package/dist/semanticfed/components/lineage/useLineageTrace.js +34 -0
  37. package/dist/semanticfed/components/lineage/useLineageTrace.js.map +1 -0
  38. package/dist/semanticfed/components/queryConsole/QueryHistoryCard.d.ts +10 -0
  39. package/dist/semanticfed/components/queryConsole/QueryHistoryCard.js +47 -0
  40. package/dist/semanticfed/components/queryConsole/QueryHistoryCard.js.map +1 -0
  41. package/dist/semanticfed/components/queryConsole/SchemaBrowser.d.ts +13 -0
  42. package/dist/semanticfed/components/queryConsole/SchemaBrowser.js +89 -0
  43. package/dist/semanticfed/components/queryConsole/SchemaBrowser.js.map +1 -0
  44. package/dist/semanticfed/components/queryConsole/SqlEditorCard.d.ts +14 -0
  45. package/dist/semanticfed/components/queryConsole/SqlEditorCard.js +69 -0
  46. package/dist/semanticfed/components/queryConsole/SqlEditorCard.js.map +1 -0
  47. package/dist/semanticfed/components/queryConsole/SqlResultCard.d.ts +14 -0
  48. package/dist/semanticfed/components/queryConsole/SqlResultCard.js +71 -0
  49. package/dist/semanticfed/components/queryConsole/SqlResultCard.js.map +1 -0
  50. package/dist/semanticfed/components/queryConsole/consoleHistory.d.ts +23 -0
  51. package/dist/semanticfed/components/queryConsole/consoleHistory.js +19 -0
  52. package/dist/semanticfed/components/queryConsole/consoleHistory.js.map +1 -0
  53. package/dist/semanticfed/hooks/useNlQuery.js +13 -10
  54. package/dist/semanticfed/hooks/useNlQuery.js.map +1 -1
  55. package/dist/semanticfed/pages/AgentsPage.js +113 -142
  56. package/dist/semanticfed/pages/AgentsPage.js.map +1 -1
  57. package/dist/semanticfed/pages/AuditPage.js +94 -75
  58. package/dist/semanticfed/pages/AuditPage.js.map +1 -1
  59. package/dist/semanticfed/pages/CollaborationPage.js +60 -64
  60. package/dist/semanticfed/pages/CollaborationPage.js.map +1 -1
  61. package/dist/semanticfed/pages/ConfigurationPage.js +82 -63
  62. package/dist/semanticfed/pages/ConfigurationPage.js.map +1 -1
  63. package/dist/semanticfed/pages/KnowledgeGraphPage.js +120 -119
  64. package/dist/semanticfed/pages/KnowledgeGraphPage.js.map +1 -1
  65. package/dist/semanticfed/pages/LineagePage.js +108 -424
  66. package/dist/semanticfed/pages/LineagePage.js.map +1 -1
  67. package/dist/semanticfed/pages/OntologyPage.js +70 -97
  68. package/dist/semanticfed/pages/OntologyPage.js.map +1 -1
  69. package/dist/semanticfed/pages/PoliciesPage.js +104 -133
  70. package/dist/semanticfed/pages/PoliciesPage.js.map +1 -1
  71. package/dist/semanticfed/pages/ProtocolPage.js +70 -74
  72. package/dist/semanticfed/pages/ProtocolPage.js.map +1 -1
  73. package/dist/semanticfed/pages/QueryConsolePage.js +160 -327
  74. package/dist/semanticfed/pages/QueryConsolePage.js.map +1 -1
  75. package/dist/semanticfed/pages/RegistryPage.js +90 -101
  76. package/dist/semanticfed/pages/RegistryPage.js.map +1 -1
  77. package/dist/semanticfed/pages/TopologyPage.js +68 -99
  78. package/dist/semanticfed/pages/TopologyPage.js.map +1 -1
  79. package/dist/semanticfed/utils/contentKeys.d.ts +16 -0
  80. package/dist/semanticfed/utils/contentKeys.js +14 -0
  81. package/dist/semanticfed/utils/contentKeys.js.map +1 -0
  82. package/package.json +2 -2
@@ -1,20 +1,18 @@
1
1
  import { AskQuestionPanel as e } from "../components/AskQuestionPanel.js";
2
2
  import { SavedQueryRunsPanel as t } from "../components/SavedQueryRunsPanel.js";
3
- import { sqlErrorMessage as n, useSemExecuteSql as r, useSemSqlCatalog as i, useSemSqlModels as a } from "../hooks/useSqlConsole.js";
4
- import { formatCell as o } from "../utils/format.js";
5
- import { translateWithFallback as s } from "../utils/i18n.js";
6
- import { useMemo as c, useState as l } from "react";
7
- import { AlertTriangle as u, CheckCircle2 as d, Clock as f, Database as p, EyeOff as m, Loader2 as h, Play as g, Plug as _, Table2 as v, Terminal as ee, XCircle as y } from "lucide-react";
8
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
9
- import { Badge as C, Button as w, Card as T, CardContent as E, CardHeader as D, CardTitle as O } from "@burdenoff/fe-libs/ui";
10
- import { useI18n as k } from "@burdenoff/fe-libs/shared/providers/shell";
3
+ import { useConsoleHistory as n } from "../components/queryConsole/consoleHistory.js";
4
+ import { QueryHistoryCard as r } from "../components/queryConsole/QueryHistoryCard.js";
5
+ import { SchemaBrowser as i } from "../components/queryConsole/SchemaBrowser.js";
6
+ import { SqlEditorCard as a } from "../components/queryConsole/SqlEditorCard.js";
7
+ import { SqlResultCard as o } from "../components/queryConsole/SqlResultCard.js";
8
+ import { sqlErrorMessage as s, useSemExecuteSql as c, useSemSqlCatalog as l, useSemSqlModels as u } from "../hooks/useSqlConsole.js";
9
+ import { useTr as d } from "../hooks/useTr.js";
10
+ import { useState as f } from "react";
11
+ import { Database as p, Plug as m, Terminal as h, XCircle as g } from "lucide-react";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ import { Badge as y, Card as b, CardContent as x, CardHeader as S, CardTitle as C } from "@burdenoff/fe-libs/ui";
11
14
  // src/semanticfed/pages/QueryConsolePage.tsx
12
- var A = [
13
- 100,
14
- 1e3,
15
- 1e4
16
- ], j = 10;
17
- function M(e) {
15
+ function w(e) {
18
16
  if (!e) return "";
19
17
  let t = e.columns.find((e) => e.kind === "DIMENSION"), n = e.columns.find((e) => e.kind === "METRIC"), r = (e) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(e) ? e : `"${e.replace(/"/g, "\"\"")}"`, i = r(e.name);
20
18
  if (t && n) {
@@ -29,344 +27,179 @@ function M(e) {
29
27
  }
30
28
  return `SELECT *\nFROM ${i}\nLIMIT 100;`;
31
29
  }
32
- function N() {
33
- let { t: N } = k(), P = (e, t, n) => s(N, e, t, n), F = a(), [I, L] = l(null), R = I ?? F.data?.[0]?.id ?? null, z = i(R), B = r(), [V, H] = l(null), U = V ?? M(z.data?.tables[0]), W = (e) => H(e), [G, K] = l(1e3), [q, J] = l(null), [Y, X] = l(null), [Z, Q] = l([]), te = c(() => F.data?.find((e) => e.id === R)?.name ?? "", [F.data, R]), $ = async () => {
34
- if (!R || U.trim() === "" || B.isPending) return;
35
- X(null);
36
- let e = U, t = {
37
- id: Date.now(),
38
- sql: e,
39
- modelName: te,
40
- executedAt: (/* @__PURE__ */ new Date()).toLocaleTimeString()
41
- };
42
- try {
43
- let n = await B.mutateAsync({
44
- sql: e,
45
- modelId: R,
46
- maxRows: G
47
- });
48
- J(n), Q((e) => [{
49
- ...t,
30
+ function T({ tr: e }) {
31
+ return /* @__PURE__ */ v("div", {
32
+ className: "flex flex-wrap items-center justify-between gap-3",
33
+ "data-tour": "semanticfed-query-console-header",
34
+ children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("h1", {
35
+ className: "text-2xl font-semibold",
36
+ children: e("semanticfed.queryConsole.title", "Query Console")
37
+ }), /* @__PURE__ */ _("p", {
38
+ className: "text-sm text-muted-foreground",
39
+ children: e("semanticfed.queryConsole.askDescription", "Ask a question in plain English or run read-only SQL against a semantic model. Every query is federated across its data sources with your access policies applied.")
40
+ })] }), /* @__PURE__ */ v("div", {
41
+ className: "flex gap-2",
42
+ children: [/* @__PURE__ */ v(y, {
43
+ variant: "outline",
44
+ className: "gap-1",
45
+ children: [/* @__PURE__ */ _(h, { className: "h-3 w-3" }), " SQL SELECT"]
46
+ }), /* @__PURE__ */ v(y, {
47
+ variant: "outline",
48
+ className: "gap-1",
49
+ children: [/* @__PURE__ */ _(m, { className: "h-3 w-3" }), e("semanticfed.queryConsole.badges.httpApi", "HTTP SQL API")]
50
+ })]
51
+ })]
52
+ });
53
+ }
54
+ function E({ modelId: e, tr: t }) {
55
+ return /* @__PURE__ */ v(b, { children: [/* @__PURE__ */ _(S, {
56
+ className: "pb-2",
57
+ children: /* @__PURE__ */ v(C, {
58
+ className: "flex items-center gap-2 text-base",
59
+ children: [/* @__PURE__ */ _(m, { className: "h-4 w-4" }), t("semanticfed.queryConsole.connect.title", "Connect BI tools and notebooks")]
60
+ })
61
+ }), /* @__PURE__ */ v(x, {
62
+ className: "space-y-2 text-xs text-muted-foreground",
63
+ children: [/* @__PURE__ */ _("p", { children: t("semanticfed.queryConsole.connect.body", "The same SQL runs over HTTPS: POST the semExecuteSql operation to the workspace API with a workspace token. Power BI (Web connector), Tableau (Web Data Connector), Python/pandas, Jupyter and reverse-ETL HTTP sources can all call it; see the SQL endpoint guide in the SemanticFed docs.") }), /* @__PURE__ */ _("pre", {
64
+ className: "overflow-x-auto rounded bg-muted p-3 font-mono text-[11px] text-foreground",
65
+ children: `mutation { semExecuteSql(input: { modelId: "${e ?? "<model-id>"}", sql: "SELECT ..." }) { columns { name dataType } rows truncated } }`
66
+ })]
67
+ })] });
68
+ }
69
+ function D() {
70
+ let e = u(), [t, r] = f(null), i = t ?? e.data?.[0]?.id ?? null, a = l(i), o = c(), [d, p] = f(null), m = d ?? w(a.data?.tables[0]), [h, g] = f(1e3), [_, v] = f(null), [y, b] = f(null), { history: x, record: S } = n(), C = e.data?.find((e) => e.id === i)?.name ?? "";
71
+ return {
72
+ models: e,
73
+ catalog: a,
74
+ modelId: i,
75
+ chooseModel: (e) => {
76
+ r(e), p(null), v(null), b(null);
77
+ },
78
+ sql: m,
79
+ setSql: p,
80
+ insertText: (e) => p(m.trim() === "" ? e : `${m}${e}`),
81
+ maxRows: h,
82
+ setMaxRows: g,
83
+ running: o.isPending,
84
+ run: async () => {
85
+ if (!i || m.trim() === "" || o.isPending) return;
86
+ b(null);
87
+ let e = m;
88
+ try {
89
+ let t = await o.mutateAsync({
90
+ sql: e,
91
+ modelId: i,
92
+ maxRows: h
93
+ });
94
+ v(t), S({
95
+ sql: e,
96
+ modelName: C,
97
+ ok: !0,
98
+ rowCount: t.rowCount,
99
+ durationMs: Math.round(t.durationMs),
100
+ message: null
101
+ });
102
+ } catch (t) {
103
+ let n = s(t);
104
+ v(null), b(n), S({
105
+ sql: e,
106
+ modelName: C,
107
+ ok: !1,
108
+ rowCount: 0,
109
+ durationMs: 0,
110
+ message: n
111
+ });
112
+ }
113
+ },
114
+ result: _,
115
+ error: y,
116
+ history: x,
117
+ showAnswer: (e) => {
118
+ b(null), v(e.result);
119
+ let { translation: t, result: n } = e;
120
+ n && t.sql && S({
121
+ sql: t.sql,
122
+ modelName: t.modelName,
50
123
  ok: !0,
51
124
  rowCount: n.rowCount,
52
125
  durationMs: Math.round(n.durationMs),
53
126
  message: null
54
- }, ...e].slice(0, j));
55
- } catch (e) {
56
- let r = n(e);
57
- J(null), X(r), Q((e) => [{
58
- ...t,
59
- ok: !1,
60
- rowCount: 0,
61
- durationMs: 0,
62
- message: r
63
- }, ...e].slice(0, j));
127
+ });
128
+ },
129
+ showAskError: (e) => {
130
+ v(null), b(e);
64
131
  }
65
- }, ne = (e) => {
66
- X(null), J(e.result);
67
- let { translation: t, result: n } = e;
68
- n && t.sql && Q((e) => [{
69
- id: Date.now(),
70
- sql: t.sql ?? "",
71
- modelName: t.modelName,
72
- executedAt: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
73
- ok: !0,
74
- rowCount: n.rowCount,
75
- durationMs: Math.round(n.durationMs),
76
- message: null
77
- }, ...e].slice(0, j));
78
- }, re = (e) => {
79
- J(null), X(e);
80
- }, ie = (e) => W(U.trim() === "" ? e : `${U}${e}`), ae = F.isSuccess && F.data.length === 0;
81
- return /* @__PURE__ */ S("div", {
132
+ };
133
+ }
134
+ function O() {
135
+ let n = d(), s = D(), { modelId: c } = s, l = s.models.isSuccess && s.models.data.length === 0;
136
+ return /* @__PURE__ */ v("div", {
82
137
  className: "space-y-6 p-6",
83
138
  children: [
84
- /* @__PURE__ */ S("div", {
85
- className: "flex flex-wrap items-center justify-between gap-3",
86
- "data-tour": "semanticfed-query-console-header",
87
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h1", {
88
- className: "text-2xl font-semibold",
89
- children: P("semanticfed.queryConsole.title", "Query Console")
90
- }), /* @__PURE__ */ x("p", {
91
- className: "text-sm text-muted-foreground",
92
- children: P("semanticfed.queryConsole.askDescription", "Ask a question in plain English or run read-only SQL against a semantic model. Every query is federated across its data sources with your access policies applied.")
93
- })] }), /* @__PURE__ */ S("div", {
94
- className: "flex gap-2",
95
- children: [/* @__PURE__ */ S(C, {
96
- variant: "outline",
97
- className: "gap-1",
98
- children: [/* @__PURE__ */ x(ee, { className: "h-3 w-3" }), " SQL SELECT"]
99
- }), /* @__PURE__ */ S(C, {
100
- variant: "outline",
101
- className: "gap-1",
102
- children: [/* @__PURE__ */ x(_, { className: "h-3 w-3" }), P("semanticfed.queryConsole.badges.httpApi", "HTTP SQL API")]
103
- })]
104
- })]
105
- }),
106
- ae && /* @__PURE__ */ x(T, { children: /* @__PURE__ */ S(E, {
139
+ /* @__PURE__ */ _(T, { tr: n }),
140
+ l && /* @__PURE__ */ _(b, { children: /* @__PURE__ */ v(x, {
107
141
  className: "flex items-center gap-3 p-6 text-sm text-muted-foreground",
108
- children: [/* @__PURE__ */ x(p, { className: "h-5 w-5" }), P("semanticfed.queryConsole.noModels", "No semantic model yet. Create a model with entities, dimensions and metrics, then query it here with SQL.")]
142
+ children: [/* @__PURE__ */ _(p, { className: "h-5 w-5" }), n("semanticfed.queryConsole.noModels", "No semantic model yet. Create a model with entities, dimensions and metrics, then query it here with SQL.")]
109
143
  }) }),
110
- /* @__PURE__ */ S("div", {
144
+ /* @__PURE__ */ v("div", {
111
145
  className: "grid gap-4 lg:grid-cols-[18rem_minmax(0,1fr)]",
112
- children: [/* @__PURE__ */ S(T, {
113
- className: "min-w-0",
114
- children: [/* @__PURE__ */ x(D, {
115
- className: "pb-3",
116
- children: /* @__PURE__ */ S(O, {
117
- className: "flex items-center gap-2 text-base",
118
- children: [/* @__PURE__ */ x(v, { className: "h-4 w-4" }), P("semanticfed.queryConsole.schema.title", "Tables")]
119
- })
120
- }), /* @__PURE__ */ S(E, {
121
- className: "space-y-3",
122
- children: [
123
- /* @__PURE__ */ x("label", {
124
- className: "block text-xs font-medium text-muted-foreground",
125
- htmlFor: "sql-console-model",
126
- children: P("semanticfed.queryConsole.schema.model", "Semantic model")
127
- }),
128
- /* @__PURE__ */ x("select", {
129
- id: "sql-console-model",
130
- "data-testid": "sql-console-model",
131
- className: "w-full rounded border bg-background p-2 text-sm",
132
- value: R ?? "",
133
- onChange: (e) => {
134
- L(e.target.value || null), H(null), J(null), X(null);
135
- },
136
- disabled: !F.data || F.data.length === 0,
137
- children: (F.data ?? []).map((e) => /* @__PURE__ */ x("option", {
138
- value: e.id,
139
- children: e.name
140
- }, e.id))
141
- }),
142
- F.isError && /* @__PURE__ */ x("p", {
143
- className: "text-xs text-destructive",
144
- children: n(F.error)
145
- }),
146
- z.isLoading && /* @__PURE__ */ x(h, { className: "h-4 w-4 animate-spin text-muted-foreground" }),
147
- z.isError && /* @__PURE__ */ x("p", {
148
- className: "text-xs text-destructive",
149
- children: n(z.error)
150
- }),
151
- /* @__PURE__ */ x("div", {
152
- className: "max-h-96 space-y-2 overflow-y-auto",
153
- "data-testid": "sql-console-tables",
154
- children: (z.data?.tables ?? []).map((e) => /* @__PURE__ */ S("details", {
155
- className: "rounded border p-2",
156
- open: z.data?.tables.length === 1,
157
- children: [/* @__PURE__ */ x("summary", {
158
- className: "cursor-pointer truncate font-mono text-xs font-medium",
159
- children: e.name
160
- }), /* @__PURE__ */ S("ul", {
161
- className: "mt-2 space-y-1",
162
- children: [e.columns.map((e) => /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S("button", {
163
- type: "button",
164
- className: "flex w-full items-center justify-between gap-2 rounded px-1 text-left font-mono text-xs hover:bg-muted",
165
- onClick: () => ie(e.name),
166
- title: e.description ?? void 0,
167
- children: [/* @__PURE__ */ x("span", {
168
- className: "truncate",
169
- children: e.name
170
- }), /* @__PURE__ */ x("span", {
171
- className: "shrink-0 text-[10px] text-muted-foreground",
172
- children: e.kind === "METRIC" ? e.aggregation ?? "METRIC" : e.dataType
173
- })]
174
- }) }, e.name)), e.columns.length === 0 && /* @__PURE__ */ x("li", {
175
- className: "text-xs text-muted-foreground",
176
- children: P("semanticfed.queryConsole.schema.noColumns", "No dimensions or metrics registered")
177
- })]
178
- })]
179
- }, e.name))
180
- })
181
- ]
182
- })]
183
- }), /* @__PURE__ */ S("div", {
146
+ children: [/* @__PURE__ */ _(i, {
147
+ models: s.models,
148
+ catalog: s.catalog,
149
+ modelId: c,
150
+ onModelChange: s.chooseModel,
151
+ onInsert: s.insertText,
152
+ tr: n
153
+ }), /* @__PURE__ */ v("div", {
184
154
  className: "min-w-0 space-y-4",
185
155
  children: [
186
- /* @__PURE__ */ x(e, {
187
- modelId: R,
188
- maxRows: G,
189
- onAnswer: ne,
190
- onError: re,
191
- onOpenInEditor: (e) => W(e)
156
+ /* @__PURE__ */ _(e, {
157
+ modelId: c,
158
+ maxRows: s.maxRows,
159
+ onAnswer: s.showAnswer,
160
+ onError: s.showAskError,
161
+ onOpenInEditor: s.setSql
192
162
  }),
193
- /* @__PURE__ */ S(T, { children: [/* @__PURE__ */ x(D, {
194
- className: "pb-3",
195
- children: /* @__PURE__ */ S("div", {
196
- className: "flex flex-wrap items-center justify-between gap-2",
197
- children: [/* @__PURE__ */ x(O, {
198
- className: "text-base",
199
- children: P("semanticfed.queryConsole.editor.title", "Query Editor")
200
- }), /* @__PURE__ */ S("div", {
201
- className: "flex items-center gap-2",
202
- children: [
203
- /* @__PURE__ */ x("label", {
204
- className: "sr-only",
205
- htmlFor: "sql-console-max-rows",
206
- children: P("semanticfed.queryConsole.editor.maxRowsLabel", "Maximum rows")
207
- }),
208
- /* @__PURE__ */ x("select", {
209
- id: "sql-console-max-rows",
210
- className: "rounded border bg-background p-1 text-xs",
211
- value: G,
212
- onChange: (e) => K(Number(e.target.value)),
213
- children: A.map((e) => /* @__PURE__ */ x("option", {
214
- value: e,
215
- children: P("semanticfed.queryConsole.editor.maxRowsOption", "Max {count} rows", { count: e.toLocaleString() })
216
- }, e))
217
- }),
218
- /* @__PURE__ */ S(w, {
219
- size: "sm",
220
- onClick: () => void $(),
221
- disabled: !R || U.trim() === "" || B.isPending,
222
- "data-testid": "sql-console-run",
223
- children: [B.isPending ? /* @__PURE__ */ x(h, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ x(g, { className: "mr-2 h-4 w-4" }), P("semanticfed.queryConsole.actions.execute", "Execute")]
224
- })
225
- ]
226
- })]
227
- })
228
- }), /* @__PURE__ */ S(E, { children: [/* @__PURE__ */ x("textarea", {
229
- "aria-label": P("semanticfed.queryConsole.editor.ariaLabel", "SQL statement"),
230
- "data-testid": "sql-console-editor",
231
- className: "w-full rounded border bg-muted/30 p-4 font-mono text-sm leading-relaxed focus:outline-none focus:ring-2 focus:ring-primary",
232
- rows: 8,
233
- value: U,
234
- onChange: (e) => W(e.target.value),
235
- onKeyDown: (e) => {
236
- (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), $());
237
- },
238
- spellCheck: !1,
239
- placeholder: "SELECT region, SUM(revenue) FROM orders GROUP BY region"
240
- }), /* @__PURE__ */ S("div", {
241
- className: "mt-2 flex flex-wrap items-center gap-4 text-xs text-muted-foreground",
242
- children: [
243
- /* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.editor.shortcut", "Ctrl/Cmd + Enter to run") }),
244
- /* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.editor.timeout", "Timeout: 30s") }),
245
- /* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.editor.supported", "SELECT, JOIN … ON, WHERE … AND, GROUP BY, ORDER BY, LIMIT/OFFSET") })
246
- ]
247
- })] })] }),
248
- Y && /* @__PURE__ */ x(T, {
163
+ /* @__PURE__ */ _(a, {
164
+ sql: s.sql,
165
+ onSqlChange: s.setSql,
166
+ maxRows: s.maxRows,
167
+ onMaxRowsChange: s.setMaxRows,
168
+ canRun: !!c && s.sql.trim() !== "",
169
+ running: s.running,
170
+ onRun: () => void s.run(),
171
+ tr: n
172
+ }),
173
+ s.error && /* @__PURE__ */ _(b, {
249
174
  "data-testid": "sql-console-error",
250
- children: /* @__PURE__ */ S(E, {
175
+ children: /* @__PURE__ */ v(x, {
251
176
  className: "flex items-start gap-3 p-4 text-sm text-destructive",
252
- children: [/* @__PURE__ */ x(y, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ x("span", {
177
+ children: [/* @__PURE__ */ _(g, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ _("span", {
253
178
  className: "break-words",
254
- children: Y
179
+ children: s.error
255
180
  })]
256
181
  })
257
182
  }),
258
- q && /* @__PURE__ */ S(T, {
259
- "data-testid": "sql-console-result",
260
- children: [/* @__PURE__ */ x(D, {
261
- className: "pb-3",
262
- children: /* @__PURE__ */ S("div", {
263
- className: "flex flex-wrap items-center gap-3 text-sm",
264
- children: [
265
- /* @__PURE__ */ x(d, { className: "h-4 w-4 text-primary" }),
266
- /* @__PURE__ */ x("span", {
267
- className: "font-medium",
268
- "data-testid": "sql-console-row-count",
269
- children: P("semanticfed.queryConsole.result.rows", "{count} rows", { count: q.rowCount.toLocaleString() })
270
- }),
271
- /* @__PURE__ */ S("span", {
272
- className: "text-muted-foreground",
273
- children: [Math.round(q.durationMs), "ms"]
274
- }),
275
- /* @__PURE__ */ x("span", {
276
- className: "text-muted-foreground",
277
- children: P("semanticfed.queryConsole.result.sources", "{count} sources", { count: q.sourcesTouched })
278
- }),
279
- q.truncated && /* @__PURE__ */ S(C, {
280
- variant: "outline",
281
- className: "gap-1",
282
- children: [/* @__PURE__ */ x(u, { className: "h-3 w-3" }), P("semanticfed.queryConsole.result.truncated", "Truncated — more rows matched")]
283
- })
284
- ]
285
- })
286
- }), /* @__PURE__ */ x(E, { children: /* @__PURE__ */ x("div", {
287
- className: "max-h-[28rem] overflow-auto rounded border",
288
- children: /* @__PURE__ */ S("table", {
289
- className: "w-max min-w-full max-w-none table-auto text-left text-xs",
290
- children: [/* @__PURE__ */ x("thead", {
291
- className: "sticky top-0 bg-muted",
292
- children: /* @__PURE__ */ x("tr", { children: q.columns.map((e) => /* @__PURE__ */ S("th", {
293
- className: "whitespace-nowrap px-3 py-2 font-medium",
294
- children: [/* @__PURE__ */ S("span", {
295
- className: "inline-flex items-center gap-1",
296
- children: [e.name, e.masked && /* @__PURE__ */ x(m, {
297
- className: "h-3 w-3 text-muted-foreground",
298
- "aria-label": P("semanticfed.queryConsole.result.masked", "Masked by policy ({mask})", { mask: e.mask ?? "" })
299
- })]
300
- }), /* @__PURE__ */ x("span", {
301
- className: "block text-[10px] font-normal text-muted-foreground",
302
- children: e.aggregation ?? e.dataType
303
- })]
304
- }, e.name)) })
305
- }), /* @__PURE__ */ S("tbody", { children: [q.rows.map((e, t) => /* @__PURE__ */ x("tr", {
306
- className: "border-t",
307
- children: q.columns.map((t) => /* @__PURE__ */ x("td", {
308
- className: "whitespace-nowrap px-3 py-1.5 font-mono",
309
- children: o(e[t.name])
310
- }, t.name))
311
- }, t)), q.rows.length === 0 && /* @__PURE__ */ x("tr", { children: /* @__PURE__ */ x("td", {
312
- colSpan: q.columns.length,
313
- className: "px-3 py-4 text-center text-muted-foreground",
314
- children: P("semanticfed.queryConsole.result.empty", "No rows matched")
315
- }) })] })]
316
- })
317
- }) })]
183
+ s.result && /* @__PURE__ */ _(o, {
184
+ result: s.result,
185
+ tr: n
318
186
  }),
319
- /* @__PURE__ */ S(T, { children: [/* @__PURE__ */ x(D, { children: /* @__PURE__ */ S(O, {
320
- className: "flex items-center gap-2 text-base",
321
- children: [/* @__PURE__ */ x(f, { className: "h-4 w-4" }), P("semanticfed.queryConsole.history.title", "Query History")]
322
- }) }), /* @__PURE__ */ x(E, { children: Z.length === 0 ? /* @__PURE__ */ x("p", {
323
- className: "text-xs text-muted-foreground",
324
- children: P("semanticfed.queryConsole.history.empty", "Statements you run in this session appear here.")
325
- }) : /* @__PURE__ */ x("div", {
326
- className: "space-y-2",
327
- children: Z.map((e) => /* @__PURE__ */ S("button", {
328
- type: "button",
329
- className: "flex w-full items-start gap-3 rounded border p-3 text-left hover:bg-muted",
330
- onClick: () => W(e.sql),
331
- children: [e.ok ? /* @__PURE__ */ x(d, { className: "mt-0.5 h-4 w-4 shrink-0 text-primary" }) : /* @__PURE__ */ x(y, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive" }), /* @__PURE__ */ S("div", {
332
- className: "min-w-0 flex-1",
333
- children: [/* @__PURE__ */ x("p", {
334
- className: "truncate font-mono text-xs",
335
- children: e.sql
336
- }), /* @__PURE__ */ S("div", {
337
- className: "mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",
338
- children: [
339
- /* @__PURE__ */ x("span", { children: e.modelName }),
340
- e.ok ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.history.results", "{count} results", { count: e.rowCount.toLocaleString() }) }), /* @__PURE__ */ S("span", { children: [e.durationMs, "ms"] })] }) : /* @__PURE__ */ x("span", {
341
- className: "truncate",
342
- children: e.message
343
- }),
344
- /* @__PURE__ */ x("span", { children: e.executedAt })
345
- ]
346
- })]
347
- })]
348
- }, e.id))
349
- }) })] }),
350
- /* @__PURE__ */ x(t, { modelId: R }, R ?? "no-model"),
351
- /* @__PURE__ */ S(T, { children: [/* @__PURE__ */ x(D, {
352
- className: "pb-2",
353
- children: /* @__PURE__ */ S(O, {
354
- className: "flex items-center gap-2 text-base",
355
- children: [/* @__PURE__ */ x(_, { className: "h-4 w-4" }), P("semanticfed.queryConsole.connect.title", "Connect BI tools and notebooks")]
356
- })
357
- }), /* @__PURE__ */ S(E, {
358
- className: "space-y-2 text-xs text-muted-foreground",
359
- children: [/* @__PURE__ */ x("p", { children: P("semanticfed.queryConsole.connect.body", "The same SQL runs over HTTPS: POST the semExecuteSql operation to the workspace API with a workspace token. Power BI (Web connector), Tableau (Web Data Connector), Python/pandas, Jupyter and reverse-ETL HTTP sources can all call it; see the SQL endpoint guide in the SemanticFed docs.") }), /* @__PURE__ */ x("pre", {
360
- className: "overflow-x-auto rounded bg-muted p-3 font-mono text-[11px] text-foreground",
361
- children: `mutation { semExecuteSql(input: { modelId: "${R ?? "<model-id>"}", sql: "SELECT ..." }) { columns { name dataType } rows truncated } }`
362
- })]
363
- })] })
187
+ /* @__PURE__ */ _(r, {
188
+ history: s.history,
189
+ onSelect: s.setSql,
190
+ tr: n
191
+ }),
192
+ /* @__PURE__ */ _(t, { modelId: c }, c ?? "no-model"),
193
+ /* @__PURE__ */ _(E, {
194
+ modelId: c,
195
+ tr: n
196
+ })
364
197
  ]
365
198
  })]
366
199
  })
367
200
  ]
368
201
  });
369
202
  }
370
- export { N as QueryConsolePage };
203
+ export { O as QueryConsolePage };
371
204
 
372
205
  //# sourceMappingURL=QueryConsolePage.js.map