@burdenoff/microfe-semanticfed 2026.1031.7 → 2026.1031.8
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/semanticfed/api/semanticfedGraphql.js +1 -1
- package/dist/semanticfed/components/SavedQueryRunsPanel.js +407 -0
- package/dist/semanticfed/components/SavedQueryRunsPanel.js.map +1 -0
- package/dist/semanticfed/hooks/useQueryRuns.js +171 -0
- package/dist/semanticfed/hooks/useQueryRuns.js.map +1 -0
- package/dist/semanticfed/pages/QueryConsolePage.js +138 -138
- package/dist/semanticfed/pages/QueryConsolePage.js.map +1 -1
- package/dist/semanticfed/providers/SemanticFedProvider.js +22 -10
- package/dist/semanticfed/providers/SemanticFedProvider.js.map +1 -1
- package/dist/semanticfed/utils/format.js +8 -0
- package/dist/semanticfed/utils/format.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQueryRuns.js","names":[],"sources":["../../../src/semanticfed/hooks/useQueryRuns.ts"],"sourcesContent":["/**\n * Saved-query run hooks (BOFF-9754), wired to the `wspace-semanticfed-svc`\n * query-run API:\n *\n * - `semListQueries` lists the workspace's saved federated queries.\n * - `semRunQuery` enqueues a run and returns it QUEUED; an async worker plans\n * and executes it, so `semQueryRun` is polled until the run is terminal\n * (SUCCEEDED / FAILED / CANCELLED).\n * - `semQueryRunResult` returns one page of the governed rows of a SUCCEEDED\n * run: columns in SELECT order with each column's access-policy mask, and\n * offset pagination through `nextOffset` (BOFF-9650).\n * - `semListQueryRuns` is the run history of a saved query, newest first.\n */\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { clearGraphqlReadCaches, semRequest } from '../api/semanticfedGraphql';\nimport { useSemanticFed } from '../providers/SemanticFedProvider';\n\nexport type SemQueryRunStatus =\n | 'QUEUED'\n | 'PLANNING'\n | 'RUNNING'\n | 'SUCCEEDED'\n | 'FAILED'\n | 'CANCELLED';\n\nexport type SemSavedQueryStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';\n\nexport interface SemSavedQuery {\n id: string;\n name: string;\n description: string | null;\n modelId: string | null;\n queryText: string;\n status: SemSavedQueryStatus;\n tags: string[];\n updatedAt: string;\n}\n\nexport interface SemQueryRun {\n id: string;\n queryId: string;\n status: SemQueryRunStatus;\n errorMessage: string | null;\n planSummary: unknown;\n rowCount: number | null;\n durationMs: number | null;\n sourcesTouched: number;\n fromCache: boolean;\n runById: string | null;\n createdAt: string;\n startedAt: string | null;\n finishedAt: string | null;\n}\n\nexport interface SemQueryRunResultColumn {\n name: string;\n entity: string;\n field: string;\n aggregation: string | null;\n masked: boolean;\n mask: string | null;\n}\n\nexport interface SemQueryRunResultPage {\n runId: string;\n queryId: string;\n columns: SemQueryRunResultColumn[];\n rows: Array<Record<string, unknown>>;\n rowCount: number;\n totalRowCount: number;\n truncated: boolean;\n offset: number;\n limit: number;\n nextOffset: number | null;\n expiresAt: string;\n}\n\n/** Rows per results page (the service allows up to 500). */\nexport const RUN_RESULT_PAGE_SIZE = 100;\n/** Saved queries offered in the picker (the picker is not paginated). */\nconst SAVED_QUERY_PICKER_LIMIT = 100;\n/** Runs shown in a saved query's history. */\nconst RUN_HISTORY_LIMIT = 20;\n/** How often an active run is polled. */\nexport const RUN_POLL_INTERVAL_MS = 1500;\n/**\n * How long after a run was created it is still polled automatically. A run\n * that is still not terminal by then (for example because the worker died\n * without marking it FAILED) is left for the user to re-check by hand.\n */\nexport const RUN_POLL_MAX_MS = 10 * 60 * 1000;\n\nconst TERMINAL_STATUSES: ReadonlySet<SemQueryRunStatus> = new Set([\n 'SUCCEEDED',\n 'FAILED',\n 'CANCELLED',\n]);\n\nexport function isTerminalRunStatus(status: SemQueryRunStatus): boolean {\n return TERMINAL_STATUSES.has(status);\n}\n\n/** True once a non-terminal run has been active longer than {@link RUN_POLL_MAX_MS}. */\nexport function isRunPollExpired(\n run: Pick<SemQueryRun, 'status' | 'createdAt'>,\n now: number = Date.now()\n): boolean {\n if (isTerminalRunStatus(run.status)) return false;\n const created = Date.parse(run.createdAt);\n return Number.isFinite(created) && now - created > RUN_POLL_MAX_MS;\n}\n\nconst RUN_FIELDS = `id\n queryId\n status\n errorMessage\n planSummary\n rowCount\n durationMs\n sourcesTouched\n fromCache\n runById\n createdAt\n startedAt\n finishedAt`;\n\nconst LIST_QUERIES_QUERY = `query SemConsoleSavedQueries($modelId: ID, $pagination: PaginationInput) {\n semListQueries(modelId: $modelId, pagination: $pagination) {\n items {\n id\n name\n description\n modelId\n queryText\n status\n tags\n updatedAt\n }\n }\n}`;\n\nconst RUN_QUERY_MUTATION = `mutation SemConsoleRunQuery($id: ID!) {\n semRunQuery(id: $id) {\n ${RUN_FIELDS}\n }\n}`;\n\nconst QUERY_RUN_QUERY = `query SemConsoleQueryRun($id: ID!) {\n semQueryRun(id: $id) {\n ${RUN_FIELDS}\n }\n}`;\n\nconst QUERY_RUNS_QUERY = `query SemConsoleQueryRuns($queryId: ID!, $pagination: PaginationInput) {\n semListQueryRuns(queryId: $queryId, pagination: $pagination) {\n items {\n ${RUN_FIELDS}\n }\n }\n}`;\n\nconst QUERY_RUN_RESULT_QUERY = `query SemConsoleQueryRunResult($runId: ID!, $pagination: PaginationInput) {\n semQueryRunResult(runId: $runId, pagination: $pagination) {\n runId\n queryId\n columns {\n name\n entity\n field\n aggregation\n masked\n mask\n }\n rows\n rowCount\n totalRowCount\n truncated\n offset\n limit\n nextOffset\n expiresAt\n }\n}`;\n\nexport function useSemSavedQueries(modelId: string | null) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'savedQueries', workspaceId ?? 'no-workspace', modelId] as const,\n enabled: Boolean(workspaceId),\n queryFn: async () => {\n const data = await semRequest<{ semListQueries: { items: SemSavedQuery[] } }>(\n LIST_QUERIES_QUERY,\n { modelId, pagination: { limit: SAVED_QUERY_PICKER_LIMIT } },\n apiGatewayUrl\n );\n // Archived queries are deleted on the service and cannot be run.\n return data.semListQueries.items.filter((q) => q.status !== 'ARCHIVED');\n },\n });\n}\n\nexport function useSemRunSavedQuery() {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (queryId: string) => {\n const data = await semRequest<{ semRunQuery: SemQueryRun }>(\n RUN_QUERY_MUTATION,\n { id: queryId },\n apiGatewayUrl\n );\n return data.semRunQuery;\n },\n onSuccess: (run) => {\n queryClient.setQueryData(\n ['semanticfed', 'queryRun', workspaceId ?? 'no-workspace', run.id],\n run\n );\n void queryClient.invalidateQueries({\n queryKey: ['semanticfed', 'queryRuns', workspaceId ?? 'no-workspace', run.queryId],\n });\n },\n });\n}\n\n/**\n * One run, polled every {@link RUN_POLL_INTERVAL_MS} until it is terminal (or\n * for at most {@link RUN_POLL_MAX_MS}). Each poll clears the shell's\n * short-lived (15 s) read cache, which would otherwise replay the QUEUED\n * response for its whole TTL. That cache is keyed by operation and variables\n * with no per-entry eviction, so it is cleared as a whole; other reads on the\n * page are held by React Query, so clearing it does not trigger refetches.\n */\nexport function useSemQueryRun(runId: string | null) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n const queryClient = useQueryClient();\n return useQuery({\n queryKey: ['semanticfed', 'queryRun', workspaceId ?? 'no-workspace', runId] as const,\n enabled: Boolean(workspaceId && runId),\n staleTime: 0,\n queryFn: async () => {\n clearGraphqlReadCaches();\n const data = await semRequest<{ semQueryRun: SemQueryRun | null }>(\n QUERY_RUN_QUERY,\n { id: runId },\n apiGatewayUrl\n );\n const run = data.semQueryRun;\n if (run && isTerminalRunStatus(run.status)) {\n void queryClient.invalidateQueries({\n queryKey: ['semanticfed', 'queryRuns', workspaceId ?? 'no-workspace', run.queryId],\n });\n }\n return run;\n },\n refetchInterval: (query) => {\n const run = query.state.data;\n if (run === null) return false;\n if (run && (isTerminalRunStatus(run.status) || isRunPollExpired(run))) return false;\n return RUN_POLL_INTERVAL_MS;\n },\n });\n}\n\nexport function useSemQueryRuns(queryId: string | null) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'queryRuns', workspaceId ?? 'no-workspace', queryId] as const,\n enabled: Boolean(workspaceId && queryId),\n staleTime: 0,\n queryFn: async () => {\n clearGraphqlReadCaches();\n const data = await semRequest<{ semListQueryRuns: { items: SemQueryRun[] } }>(\n QUERY_RUNS_QUERY,\n { queryId, pagination: { limit: RUN_HISTORY_LIMIT } },\n apiGatewayUrl\n );\n return data.semListQueryRuns.items;\n },\n });\n}\n\n/** One page of a SUCCEEDED run's governed rows; `runId` null keeps it idle. */\nexport function useSemQueryRunResult(runId: string | null, offset: number) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: [\n 'semanticfed',\n 'queryRunResult',\n workspaceId ?? 'no-workspace',\n runId,\n offset,\n ] as const,\n enabled: Boolean(workspaceId && runId),\n retry: false,\n queryFn: async () => {\n const data = await semRequest<{ semQueryRunResult: SemQueryRunResultPage }>(\n QUERY_RUN_RESULT_QUERY,\n { runId, pagination: { limit: RUN_RESULT_PAGE_SIZE, offset } },\n apiGatewayUrl\n );\n return data.semQueryRunResult;\n },\n });\n}\n\n/** One access-policy decision recorded on `planSummary.governance`. */\nexport interface SemGovernanceDecision {\n action: string;\n entity: string;\n field: string | null;\n policyName: string | null;\n mask: string | null;\n detail: string | null;\n}\n\nexport interface SemRunGovernance {\n outcome: 'ALLOWED' | 'DENIED';\n policiesEvaluated: number;\n reason: string | null;\n decisions: SemGovernanceDecision[];\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction optionalString(value: unknown): string | null {\n return typeof value === 'string' && value !== '' ? value : null;\n}\n\n/**\n * The access-policy record of a run (`planSummary.governance`), or null when\n * the run was not governed. `planSummary` is untyped JSON, so every field is\n * checked before use.\n */\nexport function runGovernance(planSummary: unknown): SemRunGovernance | null {\n const governance = asRecord(asRecord(planSummary)?.governance);\n if (!governance) return null;\n // Anything other than an explicit ALLOWED is shown as a denial, so an outcome\n // the console does not know yet can never hide a refusal.\n const outcome = governance.outcome === 'ALLOWED' ? 'ALLOWED' : 'DENIED';\n const decisions = Array.isArray(governance.decisions) ? governance.decisions : [];\n return {\n outcome,\n policiesEvaluated:\n typeof governance.policiesEvaluated === 'number' ? governance.policiesEvaluated : 0,\n reason: optionalString(governance.reason),\n decisions: decisions.flatMap((raw) => {\n const d = asRecord(raw);\n if (!d || typeof d.action !== 'string') return [];\n return [\n {\n action: d.action,\n entity: optionalString(d.entity) ?? '',\n field: optionalString(d.field),\n policyName: optionalString(d.policyName),\n mask: optionalString(d.mask),\n detail: optionalString(d.detail),\n },\n ];\n }),\n };\n}\n\n/** Decisions that removed or hid data, which a failed or partial run explains with. */\nconst RESTRICTIVE_ACTIONS: ReadonlySet<string> = new Set([\n 'ENTITY_DENIED',\n 'ROWS_BLOCKED',\n 'COLUMN_DENIED',\n 'EVALUATION_FAILED',\n]);\n\nexport function restrictiveDecisions(governance: SemRunGovernance): SemGovernanceDecision[] {\n return governance.decisions.filter((d) => RESTRICTIVE_ACTIONS.has(d.action));\n}\n"],"mappings":"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"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { translateWithFallback as e } from "../utils/i18n.js";
|
|
2
2
|
import { sqlErrorMessage as t, useSemExecuteSql as n, useSemSqlCatalog as r, useSemSqlModels as i } from "../hooks/useSqlConsole.js";
|
|
3
3
|
import { AskQuestionPanel as a } from "../components/AskQuestionPanel.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { formatCell as o } from "../utils/format.js";
|
|
5
|
+
import { SavedQueryRunsPanel as ee } from "../components/SavedQueryRunsPanel.js";
|
|
6
|
+
import { useMemo as s, useState as c } from "react";
|
|
7
|
+
import { AlertTriangle as l, CheckCircle2 as u, Clock as d, Database as f, EyeOff as p, Loader2 as m, Play as h, Plug as g, Table2 as _, Terminal as v, XCircle as y } from "lucide-react";
|
|
8
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
9
|
+
import { useI18n as C } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
|
+
import { Badge as w, Button as T, Card as E, CardContent as D, CardHeader as O, CardTitle as k } from "@burdenoff/fe-libs/ui";
|
|
9
11
|
//#region src/semanticfed/pages/QueryConsolePage.tsx
|
|
10
|
-
var
|
|
12
|
+
var A = [
|
|
11
13
|
100,
|
|
12
14
|
1e3,
|
|
13
15
|
1e4
|
|
14
|
-
],
|
|
15
|
-
function
|
|
16
|
+
], j = 10;
|
|
17
|
+
function M(e) {
|
|
16
18
|
if (!e) return "";
|
|
17
19
|
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);
|
|
18
20
|
if (t && n) {
|
|
@@ -27,46 +29,43 @@ function j(e) {
|
|
|
27
29
|
}
|
|
28
30
|
return `SELECT *\nFROM ${i}\nLIMIT 100;`;
|
|
29
31
|
}
|
|
30
|
-
function M(e) {
|
|
31
|
-
return e == null ? "NULL" : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
32
|
-
}
|
|
33
32
|
function N() {
|
|
34
|
-
let { t: N } =
|
|
35
|
-
if (!
|
|
36
|
-
|
|
37
|
-
let e =
|
|
33
|
+
let { t: N } = C(), P = (t, n, r) => e(N, t, n, r), F = i(), [I, L] = c(null), R = I ?? F.data?.[0]?.id ?? null, z = r(R), B = n(), [V, H] = c(null), U = V ?? M(z.data?.tables[0]), W = (e) => H(e), [G, K] = c(1e3), [q, J] = c(null), [Y, X] = c(null), [Z, Q] = c([]), te = s(() => 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, n = {
|
|
38
37
|
id: Date.now(),
|
|
39
38
|
sql: e,
|
|
40
|
-
modelName:
|
|
39
|
+
modelName: te,
|
|
41
40
|
executedAt: (/* @__PURE__ */ new Date()).toLocaleTimeString()
|
|
42
41
|
};
|
|
43
42
|
try {
|
|
44
|
-
let t = await
|
|
43
|
+
let t = await B.mutateAsync({
|
|
45
44
|
sql: e,
|
|
46
|
-
modelId:
|
|
47
|
-
maxRows:
|
|
45
|
+
modelId: R,
|
|
46
|
+
maxRows: G
|
|
48
47
|
});
|
|
49
|
-
|
|
48
|
+
J(t), Q((e) => [{
|
|
50
49
|
...n,
|
|
51
50
|
ok: !0,
|
|
52
51
|
rowCount: t.rowCount,
|
|
53
52
|
durationMs: Math.round(t.durationMs),
|
|
54
53
|
message: null
|
|
55
|
-
}, ...e].slice(0,
|
|
54
|
+
}, ...e].slice(0, j));
|
|
56
55
|
} catch (e) {
|
|
57
56
|
let r = t(e);
|
|
58
|
-
|
|
57
|
+
J(null), X(r), Q((e) => [{
|
|
59
58
|
...n,
|
|
60
59
|
ok: !1,
|
|
61
60
|
rowCount: 0,
|
|
62
61
|
durationMs: 0,
|
|
63
62
|
message: r
|
|
64
|
-
}, ...e].slice(0,
|
|
63
|
+
}, ...e].slice(0, j));
|
|
65
64
|
}
|
|
66
|
-
},
|
|
67
|
-
|
|
65
|
+
}, ne = (e) => {
|
|
66
|
+
X(null), J(e.result);
|
|
68
67
|
let { translation: t, result: n } = e;
|
|
69
|
-
!n || !t.sql ||
|
|
68
|
+
!n || !t.sql || Q((e) => [{
|
|
70
69
|
id: Date.now(),
|
|
71
70
|
sql: t.sql ?? "",
|
|
72
71
|
modelName: t.modelName,
|
|
@@ -75,104 +74,104 @@ function N() {
|
|
|
75
74
|
rowCount: n.rowCount,
|
|
76
75
|
durationMs: Math.round(n.durationMs),
|
|
77
76
|
message: null
|
|
78
|
-
}, ...e].slice(0,
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
return /* @__PURE__ */
|
|
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", {
|
|
83
82
|
className: "space-y-6 p-6",
|
|
84
83
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ S("div", {
|
|
86
85
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
87
86
|
"data-tour": "semanticfed-query-console-header",
|
|
88
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h1", {
|
|
89
88
|
className: "text-2xl font-semibold",
|
|
90
89
|
children: P("semanticfed.queryConsole.title", "Query Console")
|
|
91
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ x("p", {
|
|
92
91
|
className: "text-sm text-muted-foreground",
|
|
93
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.")
|
|
94
|
-
})] }), /* @__PURE__ */
|
|
93
|
+
})] }), /* @__PURE__ */ S("div", {
|
|
95
94
|
className: "flex gap-2",
|
|
96
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ S(w, {
|
|
97
96
|
variant: "outline",
|
|
98
97
|
className: "gap-1",
|
|
99
|
-
children: [/* @__PURE__ */
|
|
100
|
-
}), /* @__PURE__ */
|
|
98
|
+
children: [/* @__PURE__ */ x(v, { className: "h-3 w-3" }), " SQL SELECT"]
|
|
99
|
+
}), /* @__PURE__ */ S(w, {
|
|
101
100
|
variant: "outline",
|
|
102
101
|
className: "gap-1",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ x(g, { className: "h-3 w-3" }), P("semanticfed.queryConsole.badges.httpApi", "HTTP SQL API")]
|
|
104
103
|
})]
|
|
105
104
|
})]
|
|
106
105
|
}),
|
|
107
|
-
|
|
106
|
+
ae && /* @__PURE__ */ x(E, { children: /* @__PURE__ */ S(D, {
|
|
108
107
|
className: "flex items-center gap-3 p-6 text-sm text-muted-foreground",
|
|
109
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ x(f, { 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.")]
|
|
110
109
|
}) }),
|
|
111
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ S("div", {
|
|
112
111
|
className: "grid gap-4 lg:grid-cols-[18rem_minmax(0,1fr)]",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ S(E, {
|
|
114
113
|
className: "min-w-0",
|
|
115
|
-
children: [/* @__PURE__ */
|
|
114
|
+
children: [/* @__PURE__ */ x(O, {
|
|
116
115
|
className: "pb-3",
|
|
117
|
-
children: /* @__PURE__ */
|
|
116
|
+
children: /* @__PURE__ */ S(k, {
|
|
118
117
|
className: "flex items-center gap-2 text-base",
|
|
119
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ x(_, { className: "h-4 w-4" }), P("semanticfed.queryConsole.schema.title", "Tables")]
|
|
120
119
|
})
|
|
121
|
-
}), /* @__PURE__ */
|
|
120
|
+
}), /* @__PURE__ */ S(D, {
|
|
122
121
|
className: "space-y-3",
|
|
123
122
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ x("label", {
|
|
125
124
|
className: "block text-xs font-medium text-muted-foreground",
|
|
126
125
|
htmlFor: "sql-console-model",
|
|
127
126
|
children: P("semanticfed.queryConsole.schema.model", "Semantic model")
|
|
128
127
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ x("select", {
|
|
130
129
|
id: "sql-console-model",
|
|
131
130
|
"data-testid": "sql-console-model",
|
|
132
131
|
className: "w-full rounded border bg-background p-2 text-sm",
|
|
133
|
-
value:
|
|
132
|
+
value: R ?? "",
|
|
134
133
|
onChange: (e) => {
|
|
135
|
-
|
|
134
|
+
L(e.target.value || null), H(null), J(null), X(null);
|
|
136
135
|
},
|
|
137
136
|
disabled: !F.data || F.data.length === 0,
|
|
138
|
-
children: (F.data ?? []).map((e) => /* @__PURE__ */
|
|
137
|
+
children: (F.data ?? []).map((e) => /* @__PURE__ */ x("option", {
|
|
139
138
|
value: e.id,
|
|
140
139
|
children: e.name
|
|
141
140
|
}, e.id))
|
|
142
141
|
}),
|
|
143
|
-
F.isError && /* @__PURE__ */
|
|
142
|
+
F.isError && /* @__PURE__ */ x("p", {
|
|
144
143
|
className: "text-xs text-destructive",
|
|
145
144
|
children: t(F.error)
|
|
146
145
|
}),
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
z.isLoading && /* @__PURE__ */ x(m, { className: "h-4 w-4 animate-spin text-muted-foreground" }),
|
|
147
|
+
z.isError && /* @__PURE__ */ x("p", {
|
|
149
148
|
className: "text-xs text-destructive",
|
|
150
|
-
children: t(
|
|
149
|
+
children: t(z.error)
|
|
151
150
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ x("div", {
|
|
153
152
|
className: "max-h-96 space-y-2 overflow-y-auto",
|
|
154
153
|
"data-testid": "sql-console-tables",
|
|
155
|
-
children: (
|
|
154
|
+
children: (z.data?.tables ?? []).map((e) => /* @__PURE__ */ S("details", {
|
|
156
155
|
className: "rounded border p-2",
|
|
157
|
-
open:
|
|
158
|
-
children: [/* @__PURE__ */
|
|
156
|
+
open: z.data?.tables.length === 1,
|
|
157
|
+
children: [/* @__PURE__ */ x("summary", {
|
|
159
158
|
className: "cursor-pointer truncate font-mono text-xs font-medium",
|
|
160
159
|
children: e.name
|
|
161
|
-
}), /* @__PURE__ */
|
|
160
|
+
}), /* @__PURE__ */ S("ul", {
|
|
162
161
|
className: "mt-2 space-y-1",
|
|
163
|
-
children: [e.columns.map((e) => /* @__PURE__ */
|
|
162
|
+
children: [e.columns.map((e) => /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S("button", {
|
|
164
163
|
type: "button",
|
|
165
164
|
className: "flex w-full items-center justify-between gap-2 rounded px-1 text-left font-mono text-xs hover:bg-muted",
|
|
166
|
-
onClick: () =>
|
|
165
|
+
onClick: () => ie(e.name),
|
|
167
166
|
title: e.description ?? void 0,
|
|
168
|
-
children: [/* @__PURE__ */
|
|
167
|
+
children: [/* @__PURE__ */ x("span", {
|
|
169
168
|
className: "truncate",
|
|
170
169
|
children: e.name
|
|
171
|
-
}), /* @__PURE__ */
|
|
170
|
+
}), /* @__PURE__ */ x("span", {
|
|
172
171
|
className: "shrink-0 text-[10px] text-muted-foreground",
|
|
173
172
|
children: e.kind === "METRIC" ? e.aggregation ?? "METRIC" : e.dataType
|
|
174
173
|
})]
|
|
175
|
-
}) }, e.name)), e.columns.length === 0 && /* @__PURE__ */
|
|
174
|
+
}) }, e.name)), e.columns.length === 0 && /* @__PURE__ */ x("li", {
|
|
176
175
|
className: "text-xs text-muted-foreground",
|
|
177
176
|
children: P("semanticfed.queryConsole.schema.noColumns", "No dimensions or metrics registered")
|
|
178
177
|
})]
|
|
@@ -181,184 +180,185 @@ function N() {
|
|
|
181
180
|
})
|
|
182
181
|
]
|
|
183
182
|
})]
|
|
184
|
-
}), /* @__PURE__ */
|
|
183
|
+
}), /* @__PURE__ */ S("div", {
|
|
185
184
|
className: "min-w-0 space-y-4",
|
|
186
185
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
modelId:
|
|
189
|
-
maxRows:
|
|
190
|
-
onAnswer:
|
|
191
|
-
onError:
|
|
192
|
-
onOpenInEditor: (e) =>
|
|
186
|
+
/* @__PURE__ */ x(a, {
|
|
187
|
+
modelId: R,
|
|
188
|
+
maxRows: G,
|
|
189
|
+
onAnswer: ne,
|
|
190
|
+
onError: re,
|
|
191
|
+
onOpenInEditor: (e) => W(e)
|
|
193
192
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ S(E, { children: [/* @__PURE__ */ x(O, {
|
|
195
194
|
className: "pb-3",
|
|
196
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ S("div", {
|
|
197
196
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
197
|
+
children: [/* @__PURE__ */ x(k, {
|
|
199
198
|
className: "text-base",
|
|
200
199
|
children: P("semanticfed.queryConsole.editor.title", "Query Editor")
|
|
201
|
-
}), /* @__PURE__ */
|
|
200
|
+
}), /* @__PURE__ */ S("div", {
|
|
202
201
|
className: "flex items-center gap-2",
|
|
203
202
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ x("label", {
|
|
205
204
|
className: "sr-only",
|
|
206
205
|
htmlFor: "sql-console-max-rows",
|
|
207
206
|
children: P("semanticfed.queryConsole.editor.maxRowsLabel", "Maximum rows")
|
|
208
207
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ x("select", {
|
|
210
209
|
id: "sql-console-max-rows",
|
|
211
210
|
className: "rounded border bg-background p-1 text-xs",
|
|
212
|
-
value:
|
|
213
|
-
onChange: (e) =>
|
|
214
|
-
children:
|
|
211
|
+
value: G,
|
|
212
|
+
onChange: (e) => K(Number(e.target.value)),
|
|
213
|
+
children: A.map((e) => /* @__PURE__ */ x("option", {
|
|
215
214
|
value: e,
|
|
216
215
|
children: P("semanticfed.queryConsole.editor.maxRowsOption", "Max {count} rows", { count: e.toLocaleString() })
|
|
217
216
|
}, e))
|
|
218
217
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ S(T, {
|
|
220
219
|
size: "sm",
|
|
221
220
|
onClick: () => void $(),
|
|
222
|
-
disabled: !
|
|
221
|
+
disabled: !R || U.trim() === "" || B.isPending,
|
|
223
222
|
"data-testid": "sql-console-run",
|
|
224
|
-
children: [
|
|
223
|
+
children: [B.isPending ? /* @__PURE__ */ x(m, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ x(h, { className: "mr-2 h-4 w-4" }), P("semanticfed.queryConsole.actions.execute", "Execute")]
|
|
225
224
|
})
|
|
226
225
|
]
|
|
227
226
|
})]
|
|
228
227
|
})
|
|
229
|
-
}), /* @__PURE__ */
|
|
228
|
+
}), /* @__PURE__ */ S(D, { children: [/* @__PURE__ */ x("textarea", {
|
|
230
229
|
"aria-label": P("semanticfed.queryConsole.editor.ariaLabel", "SQL statement"),
|
|
231
230
|
"data-testid": "sql-console-editor",
|
|
232
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",
|
|
233
232
|
rows: 8,
|
|
234
|
-
value:
|
|
235
|
-
onChange: (e) =>
|
|
233
|
+
value: U,
|
|
234
|
+
onChange: (e) => W(e.target.value),
|
|
236
235
|
onKeyDown: (e) => {
|
|
237
236
|
(e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), $());
|
|
238
237
|
},
|
|
239
238
|
spellCheck: !1,
|
|
240
239
|
placeholder: "SELECT region, SUM(revenue) FROM orders GROUP BY region"
|
|
241
|
-
}), /* @__PURE__ */
|
|
240
|
+
}), /* @__PURE__ */ S("div", {
|
|
242
241
|
className: "mt-2 flex flex-wrap items-center gap-4 text-xs text-muted-foreground",
|
|
243
242
|
children: [
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
/* @__PURE__ */
|
|
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") })
|
|
247
246
|
]
|
|
248
247
|
})] })] }),
|
|
249
|
-
|
|
248
|
+
Y && /* @__PURE__ */ x(E, {
|
|
250
249
|
"data-testid": "sql-console-error",
|
|
251
|
-
children: /* @__PURE__ */
|
|
250
|
+
children: /* @__PURE__ */ S(D, {
|
|
252
251
|
className: "flex items-start gap-3 p-4 text-sm text-destructive",
|
|
253
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ x(y, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ x("span", {
|
|
254
253
|
className: "break-words",
|
|
255
|
-
children:
|
|
254
|
+
children: Y
|
|
256
255
|
})]
|
|
257
256
|
})
|
|
258
257
|
}),
|
|
259
|
-
|
|
258
|
+
q && /* @__PURE__ */ S(E, {
|
|
260
259
|
"data-testid": "sql-console-result",
|
|
261
|
-
children: [/* @__PURE__ */
|
|
260
|
+
children: [/* @__PURE__ */ x(O, {
|
|
262
261
|
className: "pb-3",
|
|
263
|
-
children: /* @__PURE__ */
|
|
262
|
+
children: /* @__PURE__ */ S("div", {
|
|
264
263
|
className: "flex flex-wrap items-center gap-3 text-sm",
|
|
265
264
|
children: [
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ x(u, { className: "h-4 w-4 text-primary" }),
|
|
266
|
+
/* @__PURE__ */ x("span", {
|
|
268
267
|
className: "font-medium",
|
|
269
268
|
"data-testid": "sql-console-row-count",
|
|
270
|
-
children: P("semanticfed.queryConsole.result.rows", "{count} rows", { count:
|
|
269
|
+
children: P("semanticfed.queryConsole.result.rows", "{count} rows", { count: q.rowCount.toLocaleString() })
|
|
271
270
|
}),
|
|
272
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ S("span", {
|
|
273
272
|
className: "text-muted-foreground",
|
|
274
|
-
children: [Math.round(
|
|
273
|
+
children: [Math.round(q.durationMs), "ms"]
|
|
275
274
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ x("span", {
|
|
277
276
|
className: "text-muted-foreground",
|
|
278
|
-
children: P("semanticfed.queryConsole.result.sources", "{count} sources", { count:
|
|
277
|
+
children: P("semanticfed.queryConsole.result.sources", "{count} sources", { count: q.sourcesTouched })
|
|
279
278
|
}),
|
|
280
|
-
|
|
279
|
+
q.truncated && /* @__PURE__ */ S(w, {
|
|
281
280
|
variant: "outline",
|
|
282
281
|
className: "gap-1",
|
|
283
|
-
children: [/* @__PURE__ */
|
|
282
|
+
children: [/* @__PURE__ */ x(l, { className: "h-3 w-3" }), P("semanticfed.queryConsole.result.truncated", "Truncated — more rows matched")]
|
|
284
283
|
})
|
|
285
284
|
]
|
|
286
285
|
})
|
|
287
|
-
}), /* @__PURE__ */
|
|
286
|
+
}), /* @__PURE__ */ x(D, { children: /* @__PURE__ */ x("div", {
|
|
288
287
|
className: "max-h-[28rem] overflow-auto rounded border",
|
|
289
|
-
children: /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ S("table", {
|
|
290
289
|
className: "w-full text-left text-xs",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
290
|
+
children: [/* @__PURE__ */ x("thead", {
|
|
292
291
|
className: "sticky top-0 bg-muted",
|
|
293
|
-
children: /* @__PURE__ */
|
|
292
|
+
children: /* @__PURE__ */ x("tr", { children: q.columns.map((e) => /* @__PURE__ */ S("th", {
|
|
294
293
|
className: "whitespace-nowrap px-3 py-2 font-medium",
|
|
295
|
-
children: [/* @__PURE__ */
|
|
294
|
+
children: [/* @__PURE__ */ S("span", {
|
|
296
295
|
className: "inline-flex items-center gap-1",
|
|
297
|
-
children: [e.name, e.masked && /* @__PURE__ */
|
|
296
|
+
children: [e.name, e.masked && /* @__PURE__ */ x(p, {
|
|
298
297
|
className: "h-3 w-3 text-muted-foreground",
|
|
299
298
|
"aria-label": P("semanticfed.queryConsole.result.masked", "Masked by policy ({mask})", { mask: e.mask ?? "" })
|
|
300
299
|
})]
|
|
301
|
-
}), /* @__PURE__ */
|
|
300
|
+
}), /* @__PURE__ */ x("span", {
|
|
302
301
|
className: "block text-[10px] font-normal text-muted-foreground",
|
|
303
302
|
children: e.aggregation ?? e.dataType
|
|
304
303
|
})]
|
|
305
304
|
}, e.name)) })
|
|
306
|
-
}), /* @__PURE__ */
|
|
305
|
+
}), /* @__PURE__ */ S("tbody", { children: [q.rows.map((e, t) => /* @__PURE__ */ x("tr", {
|
|
307
306
|
className: "border-t",
|
|
308
|
-
children:
|
|
307
|
+
children: q.columns.map((t) => /* @__PURE__ */ x("td", {
|
|
309
308
|
className: "whitespace-nowrap px-3 py-1.5 font-mono",
|
|
310
|
-
children:
|
|
309
|
+
children: o(e[t.name])
|
|
311
310
|
}, t.name))
|
|
312
|
-
}, t)),
|
|
313
|
-
colSpan:
|
|
311
|
+
}, t)), q.rows.length === 0 && /* @__PURE__ */ x("tr", { children: /* @__PURE__ */ x("td", {
|
|
312
|
+
colSpan: q.columns.length,
|
|
314
313
|
className: "px-3 py-4 text-center text-muted-foreground",
|
|
315
314
|
children: P("semanticfed.queryConsole.result.empty", "No rows matched")
|
|
316
315
|
}) })] })]
|
|
317
316
|
})
|
|
318
317
|
}) })]
|
|
319
318
|
}),
|
|
320
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ S(E, { children: [/* @__PURE__ */ x(O, { children: /* @__PURE__ */ S(k, {
|
|
321
320
|
className: "flex items-center gap-2 text-base",
|
|
322
|
-
children: [/* @__PURE__ */
|
|
323
|
-
}) }), /* @__PURE__ */
|
|
321
|
+
children: [/* @__PURE__ */ x(d, { className: "h-4 w-4" }), P("semanticfed.queryConsole.history.title", "Query History")]
|
|
322
|
+
}) }), /* @__PURE__ */ x(D, { children: Z.length === 0 ? /* @__PURE__ */ x("p", {
|
|
324
323
|
className: "text-xs text-muted-foreground",
|
|
325
324
|
children: P("semanticfed.queryConsole.history.empty", "Statements you run in this session appear here.")
|
|
326
|
-
}) : /* @__PURE__ */
|
|
325
|
+
}) : /* @__PURE__ */ x("div", {
|
|
327
326
|
className: "space-y-2",
|
|
328
|
-
children:
|
|
327
|
+
children: Z.map((e) => /* @__PURE__ */ S("button", {
|
|
329
328
|
type: "button",
|
|
330
329
|
className: "flex w-full items-start gap-3 rounded border p-3 text-left hover:bg-muted",
|
|
331
|
-
onClick: () =>
|
|
332
|
-
children: [e.ok ? /* @__PURE__ */
|
|
330
|
+
onClick: () => W(e.sql),
|
|
331
|
+
children: [e.ok ? /* @__PURE__ */ x(u, { 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", {
|
|
333
332
|
className: "min-w-0 flex-1",
|
|
334
|
-
children: [/* @__PURE__ */
|
|
333
|
+
children: [/* @__PURE__ */ x("p", {
|
|
335
334
|
className: "truncate font-mono text-xs",
|
|
336
335
|
children: e.sql
|
|
337
|
-
}), /* @__PURE__ */
|
|
336
|
+
}), /* @__PURE__ */ S("div", {
|
|
338
337
|
className: "mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",
|
|
339
338
|
children: [
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
e.ok ? /* @__PURE__ */
|
|
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", {
|
|
342
341
|
className: "truncate",
|
|
343
342
|
children: e.message
|
|
344
343
|
}),
|
|
345
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ x("span", { children: e.executedAt })
|
|
346
345
|
]
|
|
347
346
|
})]
|
|
348
347
|
})]
|
|
349
348
|
}, e.id))
|
|
350
349
|
}) })] }),
|
|
351
|
-
/* @__PURE__ */ x(
|
|
350
|
+
/* @__PURE__ */ x(ee, { modelId: R }, R ?? "no-model"),
|
|
351
|
+
/* @__PURE__ */ S(E, { children: [/* @__PURE__ */ x(O, {
|
|
352
352
|
className: "pb-2",
|
|
353
|
-
children: /* @__PURE__ */
|
|
353
|
+
children: /* @__PURE__ */ S(k, {
|
|
354
354
|
className: "flex items-center gap-2 text-base",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
355
|
+
children: [/* @__PURE__ */ x(g, { className: "h-4 w-4" }), P("semanticfed.queryConsole.connect.title", "Connect BI tools and notebooks")]
|
|
356
356
|
})
|
|
357
|
-
}), /* @__PURE__ */
|
|
357
|
+
}), /* @__PURE__ */ S(D, {
|
|
358
358
|
className: "space-y-2 text-xs text-muted-foreground",
|
|
359
|
-
children: [/* @__PURE__ */
|
|
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
360
|
className: "overflow-x-auto rounded bg-muted p-3 font-mono text-[11px] text-foreground",
|
|
361
|
-
children: `mutation { semExecuteSql(input: { modelId: "${
|
|
361
|
+
children: `mutation { semExecuteSql(input: { modelId: "${R ?? "<model-id>"}", sql: "SELECT ..." }) { columns { name dataType } rows truncated } }`
|
|
362
362
|
})]
|
|
363
363
|
})] })
|
|
364
364
|
]
|