@burdenoff/microfe-semanticfed 2026.1113.1 → 2026.1201.1
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/SemanticFedRoot.js +66 -94
- package/dist/semanticfed/SemanticFedRoot.js.map +1 -1
- package/dist/semanticfed/SemanticFedRoutes.js +24 -37
- package/dist/semanticfed/SemanticFedRoutes.js.map +1 -1
- package/dist/semanticfed/api/clientAnalytics.d.ts +5 -1
- package/dist/semanticfed/api/clientAnalytics.js +65 -26
- package/dist/semanticfed/api/clientAnalytics.js.map +1 -1
- package/dist/semanticfed/components/OnboardingChecklist.js +87 -80
- package/dist/semanticfed/components/OnboardingChecklist.js.map +1 -1
- package/dist/semanticfed/components/TableHeaders.js +2 -11
- package/dist/semanticfed/components/TableHeaders.js.map +1 -1
- package/dist/semanticfed/hooks/useClientAnalytics.d.ts +4 -0
- package/dist/semanticfed/hooks/useClientAnalytics.js +1 -1
- package/dist/semanticfed/hooks/useClientAnalytics.js.map +1 -1
- package/dist/semanticfed/hooks/useExperiment.d.ts +14 -0
- package/dist/semanticfed/hooks/useExperiment.js +39 -0
- package/dist/semanticfed/hooks/useExperiment.js.map +1 -0
- package/dist/semanticfed/hooks/useNlQuery.js +37 -33
- package/dist/semanticfed/hooks/useNlQuery.js.map +1 -1
- package/dist/semanticfed/hooks/useQueryAnalytics.d.ts +214 -0
- package/dist/semanticfed/hooks/useQueryAnalytics.js +57 -3
- package/dist/semanticfed/hooks/useQueryAnalytics.js.map +1 -1
- package/dist/semanticfed/pages/AnalyticsPage.js +294 -89
- package/dist/semanticfed/pages/AnalyticsPage.js.map +1 -1
- package/dist/semanticfed/pages/LineagePage.js +75 -62
- package/dist/semanticfed/pages/LineagePage.js.map +1 -1
- package/dist/semanticfed/pages/MonitoringPage.js +91 -230
- package/dist/semanticfed/pages/MonitoringPage.js.map +1 -1
- package/dist/semanticfed/pages/RegistryPage.js +97 -91
- package/dist/semanticfed/pages/RegistryPage.js.map +1 -1
- package/dist/semanticfed/store/semanticfedStore.d.ts +1 -13
- package/dist/semanticfed/store/semanticfedStore.js +0 -378
- package/dist/semanticfed/store/semanticfedStore.js.map +1 -1
- package/dist/semanticfed/translations/english.js +40 -132
- package/dist/semanticfed/translations/english.js.map +1 -1
- package/dist/semanticfed/translations/english.json.d.ts +40 -132
- package/dist/semanticfed/types/index.d.ts +0 -53
- package/package.json +13 -13
- package/dist/semanticfed/pages/AgentsPage.d.ts +0 -2
- package/dist/semanticfed/pages/AgentsPage.js +0 -207
- package/dist/semanticfed/pages/AgentsPage.js.map +0 -1
- package/dist/semanticfed/pages/KnowledgeGraphPage.d.ts +0 -1
- package/dist/semanticfed/pages/KnowledgeGraphPage.js +0 -245
- package/dist/semanticfed/pages/KnowledgeGraphPage.js.map +0 -1
- package/dist/semanticfed/pages/OntologyPage.d.ts +0 -1
- package/dist/semanticfed/pages/OntologyPage.js +0 -144
- package/dist/semanticfed/pages/OntologyPage.js.map +0 -1
- package/dist/semanticfed/pages/TopologyPage.d.ts +0 -2
- package/dist/semanticfed/pages/TopologyPage.js +0 -146
- package/dist/semanticfed/pages/TopologyPage.js.map +0 -1
- package/dist/semanticfed/pages/VisualizationPage.d.ts +0 -2
- package/dist/semanticfed/pages/VisualizationPage.js +0 -276
- package/dist/semanticfed/pages/VisualizationPage.js.map +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { semRequest as e } from "../api/semanticfedGraphql.js";
|
|
2
2
|
import { useSemanticFed as t } from "../providers/SemanticFedProvider.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useClientAnalytics as n } from "./useClientAnalytics.js";
|
|
4
|
+
import { useMutation as r, useQuery as i, useQueryClient as a } from "@tanstack/react-query";
|
|
4
5
|
// src/semanticfed/hooks/useNlQuery.ts
|
|
5
|
-
var
|
|
6
|
-
semNlSettings {${
|
|
6
|
+
var o = "\n modelId\n modelName\n question\n status\n sql\n confidence\n steps {\n kind\n entity\n field\n aggregation\n governed\n operator\n value\n direction\n count\n relationship\n }\n unmatchedTerms\n clarificationReason\n clarification\n suggestions\n engine\n followUp\n assist\n rephrasedQuestion\n assistProvider", s = "\n llmAssistEnabled\n aiConnectionId\n aiProviderKey\n aiModel\n defaultAiModel\n supportedProviders\n updatedAt\n updatedBy", c = `query SemNlSettings {
|
|
7
|
+
semNlSettings {${s}
|
|
7
8
|
}
|
|
8
|
-
}`,
|
|
9
|
-
semUpdateNlSettings(input: $input) {${
|
|
9
|
+
}`, l = `mutation SemUpdateNlSettings($input: SemUpdateNlSettingsInput!) {
|
|
10
|
+
semUpdateNlSettings(input: $input) {${s}
|
|
10
11
|
}
|
|
11
|
-
}`,
|
|
12
|
+
}`, u = "query SemAiConnections($filter: ConnectionFilterInput, $pagination: IntegrationsPaginationInput) {\n getConnections(filter: $filter, pagination: $pagination) {\n items {\n id\n name\n status\n provider {\n key\n name\n }\n }\n }\n}", d = "query SemNlSuggestions($input: SemNlQuestionInput!) {\n semTranslateQuestion(input: $input) {\n modelId\n suggestions\n }\n}", f = `mutation SemAskQuestion($input: SemNlQuestionInput!) {
|
|
12
13
|
semAskQuestion(input: $input) {
|
|
13
|
-
translation {${
|
|
14
|
+
translation {${o}
|
|
14
15
|
}
|
|
15
16
|
result {
|
|
16
17
|
modelId
|
|
@@ -31,9 +32,9 @@ var a = "\n modelId\n modelName\n question\n status\n sql\n co
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
}`;
|
|
34
|
-
function
|
|
35
|
-
let { apiGatewayUrl:
|
|
36
|
-
return
|
|
35
|
+
function p(n) {
|
|
36
|
+
let { apiGatewayUrl: r, workspaceId: a } = t();
|
|
37
|
+
return i({
|
|
37
38
|
queryKey: [
|
|
38
39
|
"semanticfed",
|
|
39
40
|
"nl",
|
|
@@ -42,55 +43,58 @@ function f(n) {
|
|
|
42
43
|
n
|
|
43
44
|
],
|
|
44
45
|
enabled: !!(a && n),
|
|
45
|
-
queryFn: async () => (await e(
|
|
46
|
+
queryFn: async () => (await e(d, { input: {
|
|
46
47
|
question: "",
|
|
47
48
|
modelId: n
|
|
48
|
-
} },
|
|
49
|
+
} }, r)).semTranslateQuestion.suggestions
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
let { apiGatewayUrl:
|
|
53
|
-
return
|
|
52
|
+
function m() {
|
|
53
|
+
let { apiGatewayUrl: i } = t(), a = n();
|
|
54
|
+
return r({ mutationFn: async (t) => {
|
|
55
|
+
let n = (await e(f, { input: t }, i)).semAskQuestion;
|
|
56
|
+
return a.nlAsked(n.translation.status, !!n.result, n.translation.followUp, n.result?.durationMs ?? null), n;
|
|
57
|
+
} });
|
|
54
58
|
}
|
|
55
|
-
var
|
|
59
|
+
var h = (e) => [
|
|
56
60
|
"semanticfed",
|
|
57
61
|
"nl",
|
|
58
62
|
"settings",
|
|
59
63
|
e ?? "no-workspace"
|
|
60
64
|
];
|
|
61
|
-
function
|
|
62
|
-
let { apiGatewayUrl: n, workspaceId:
|
|
63
|
-
return
|
|
64
|
-
queryKey:
|
|
65
|
-
enabled: !!
|
|
66
|
-
queryFn: async () => (await e(
|
|
65
|
+
function g() {
|
|
66
|
+
let { apiGatewayUrl: n, workspaceId: r } = t();
|
|
67
|
+
return i({
|
|
68
|
+
queryKey: h(r),
|
|
69
|
+
enabled: !!r,
|
|
70
|
+
queryFn: async () => (await e(c, {}, n)).semNlSettings
|
|
67
71
|
});
|
|
68
72
|
}
|
|
69
|
-
function
|
|
70
|
-
let { apiGatewayUrl:
|
|
71
|
-
return
|
|
72
|
-
mutationFn: async (t) => (await e(
|
|
73
|
+
function _() {
|
|
74
|
+
let { apiGatewayUrl: n, workspaceId: i } = t(), o = a();
|
|
75
|
+
return r({
|
|
76
|
+
mutationFn: async (t) => (await e(l, { input: t }, n)).semUpdateNlSettings,
|
|
73
77
|
onSuccess: (e) => {
|
|
74
|
-
o.setQueryData(
|
|
78
|
+
o.setQueryData(h(i), e);
|
|
75
79
|
}
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
|
-
function
|
|
82
|
+
function v(n, r) {
|
|
79
83
|
let { apiGatewayUrl: a, workspaceId: o } = t();
|
|
80
|
-
return
|
|
84
|
+
return i({
|
|
81
85
|
queryKey: [
|
|
82
86
|
"semanticfed",
|
|
83
87
|
"nl",
|
|
84
88
|
"ai-connections",
|
|
85
89
|
o ?? "no-workspace",
|
|
86
|
-
|
|
90
|
+
r.join(",")
|
|
87
91
|
],
|
|
88
92
|
enabled: !!o && n,
|
|
89
93
|
queryFn: async () => {
|
|
90
|
-
let t = await e(
|
|
94
|
+
let t = await e(u, {
|
|
91
95
|
filter: { status: "ACTIVE" },
|
|
92
96
|
pagination: { limit: 100 }
|
|
93
|
-
}, a), n = new Set(
|
|
97
|
+
}, a), n = new Set(r);
|
|
94
98
|
return t.getConnections.items.filter((e) => e.provider && n.has(e.provider.key)).map((e) => ({
|
|
95
99
|
id: e.id,
|
|
96
100
|
name: e.name,
|
|
@@ -101,6 +105,6 @@ function _(n, i) {
|
|
|
101
105
|
}
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
|
-
export {
|
|
108
|
+
export { v as useSemAiConnections, m as useSemAskQuestion, g as useSemNlSettings, p as useSemNlSuggestions, _ as useSemUpdateNlSettings };
|
|
105
109
|
|
|
106
110
|
//# sourceMappingURL=useNlQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNlQuery.js","names":["TRANSLATION_FIELDS","SETTINGS_FIELDS","NL_SETTINGS_QUERY","UPDATE_NL_SETTINGS_MUTATION","AI_CONNECTIONS_QUERY","SUGGESTIONS_QUERY","ASK_QUESTION_MUTATION","useSemNlSuggestions","useSemanticFed","useQuery","workspaceId","modelId","semRequest","apiGatewayUrl","useSemAskQuestion","useMutation","nlSettingsKey","useSemNlSettings","useSemUpdateNlSettings","queryClient","useQueryClient","settings","useSemAiConnections","supportedProviders","enabled","data","supported","c"],"sources":["../../../src/semanticfed/hooks/useNlQuery.ts"],"sourcesContent":["/**\n * Natural-language question hooks (BOFF-4276), wired to the\n * `wspace-semanticfed-svc` NL module:\n *\n * - `semTranslateQuestion` translates a question into SQL over the model's\n * governed entities, dimensions and metrics without running it. Asked with\n * an empty question it returns only the example questions the model can\n * answer, which the console offers as starting points.\n * - `semAskQuestion` translates the question and runs the generated SQL\n * through the SQL endpoint with the caller's access policies applied. It is\n * metered as one query run.\n * - Follow-ups (BOFF-10533): the earlier questions of the conversation are\n * sent as `history`, so \"and by status?\" or \"only EU\" refine the previous\n * interpretation.\n * - LLM-assisted phrasing (BOFF-10533): `semNlSettings` /\n * `semUpdateNlSettings` turn on rewording by the workspace's own AI\n * provider (an OpenAI or Anthropic connection from Integrations).\n */\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { semRequest } from '../api/semanticfedGraphql';\nimport { useSemanticFed } from '../providers/SemanticFedProvider';\nimport type { SemSqlResult } from './useSqlConsole';\n\nexport type SemNlStatus = 'TRANSLATED' | 'NEEDS_CLARIFICATION';\n\nexport type SemNlClarificationReason =\n | 'EMPTY_QUESTION'\n | 'TOO_LONG'\n | 'NO_MATCH'\n | 'NO_JOIN_PATH'\n | 'UNSUPPORTED_AGGREGATION'\n | 'INVALID_FILTER'\n | 'LOW_CONFIDENCE'\n | 'INVALID_QUERY'\n | 'UNPLACED_VALUE';\n\nexport type SemNlAssistStatus =\n | 'NOT_NEEDED'\n | 'SKIPPED'\n | 'DISABLED'\n | 'NOT_CONFIGURED'\n | 'QUOTA_EXHAUSTED'\n | 'QUOTA_UNAVAILABLE'\n | 'PROVIDER_ERROR'\n | 'NO_IMPROVEMENT'\n | 'REPHRASED';\n\nexport type SemNlStepKind =\n 'ENTITY' | 'JOIN' | 'COLUMN' | 'MEASURE' | 'GROUP_BY' | 'FILTER' | 'ORDER' | 'LIMIT';\n\nexport interface SemNlStep {\n kind: SemNlStepKind;\n entity: string | null;\n field: string | null;\n aggregation: string | null;\n governed: boolean;\n operator: string | null;\n value: unknown;\n direction: string | null;\n count: number | null;\n relationship: string | null;\n}\n\nexport interface SemNlTranslation {\n modelId: string;\n modelName: string;\n question: string;\n status: SemNlStatus;\n sql: string | null;\n confidence: number;\n steps: SemNlStep[];\n unmatchedTerms: string[];\n clarificationReason: SemNlClarificationReason | null;\n clarification: string | null;\n suggestions: string[];\n engine: string;\n followUp: boolean;\n assist: SemNlAssistStatus;\n rephrasedQuestion: string | null;\n assistProvider: string | null;\n}\n\nexport interface SemNlAnswer {\n translation: SemNlTranslation;\n result: SemSqlResult | null;\n}\n\nexport interface SemNlQuestionInput {\n question: string;\n modelId: string;\n maxRows?: number;\n /** Earlier questions of the conversation, oldest first. */\n history?: string[];\n}\n\nexport interface SemNlSettings {\n llmAssistEnabled: boolean;\n aiConnectionId: string | null;\n aiProviderKey: string | null;\n aiModel: string | null;\n defaultAiModel: string | null;\n supportedProviders: string[];\n updatedAt: string | null;\n updatedBy: string | null;\n}\n\nexport interface SemUpdateNlSettingsInput {\n llmAssistEnabled: boolean;\n aiConnectionId: string | null;\n aiModel: string | null;\n}\n\n/** An integration connection that can hold the workspace's AI provider key. */\nexport interface SemAiConnection {\n id: string;\n name: string;\n status: string;\n providerKey: string;\n providerName: string;\n}\n\nconst TRANSLATION_FIELDS = `\n modelId\n modelName\n question\n status\n sql\n confidence\n steps {\n kind\n entity\n field\n aggregation\n governed\n operator\n value\n direction\n count\n relationship\n }\n unmatchedTerms\n clarificationReason\n clarification\n suggestions\n engine\n followUp\n assist\n rephrasedQuestion\n assistProvider`;\n\nconst SETTINGS_FIELDS = `\n llmAssistEnabled\n aiConnectionId\n aiProviderKey\n aiModel\n defaultAiModel\n supportedProviders\n updatedAt\n updatedBy`;\n\nconst NL_SETTINGS_QUERY = `query SemNlSettings {\n semNlSettings {${SETTINGS_FIELDS}\n }\n}`;\n\nconst UPDATE_NL_SETTINGS_MUTATION = `mutation SemUpdateNlSettings($input: SemUpdateNlSettingsInput!) {\n semUpdateNlSettings(input: $input) {${SETTINGS_FIELDS}\n }\n}`;\n\nconst AI_CONNECTIONS_QUERY = `query SemAiConnections($filter: ConnectionFilterInput, $pagination: IntegrationsPaginationInput) {\n getConnections(filter: $filter, pagination: $pagination) {\n items {\n id\n name\n status\n provider {\n key\n name\n }\n }\n }\n}`;\n\nconst SUGGESTIONS_QUERY = `query SemNlSuggestions($input: SemNlQuestionInput!) {\n semTranslateQuestion(input: $input) {\n modelId\n suggestions\n }\n}`;\n\nconst ASK_QUESTION_MUTATION = `mutation SemAskQuestion($input: SemNlQuestionInput!) {\n semAskQuestion(input: $input) {\n translation {${TRANSLATION_FIELDS}\n }\n result {\n modelId\n columns {\n name\n entity\n field\n aggregation\n dataType\n masked\n mask\n }\n rows\n rowCount\n truncated\n durationMs\n sourcesTouched\n }\n }\n}`;\n\n/** Example questions the model can answer (translation only: reads no data, not metered). */\nexport function useSemNlSuggestions(modelId: string | null) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'nl', 'suggestions', workspaceId ?? 'no-workspace', modelId] as const,\n enabled: Boolean(workspaceId && modelId),\n queryFn: async () => {\n const data = await semRequest<{\n semTranslateQuestion: Pick<SemNlTranslation, 'modelId' | 'suggestions'>;\n }>(SUGGESTIONS_QUERY, { input: { question: '', modelId } }, apiGatewayUrl);\n return data.semTranslateQuestion.suggestions;\n },\n });\n}\n\n/** Translate a question and run it with the caller's access policies (one metered query run). */\nexport function useSemAskQuestion() {\n const { apiGatewayUrl } = useSemanticFed();\n return useMutation({\n mutationFn: async (input: SemNlQuestionInput) => {\n const data = await semRequest<{ semAskQuestion: SemNlAnswer }>(\n ASK_QUESTION_MUTATION,\n { input },\n apiGatewayUrl\n );\n return data.semAskQuestion;\n },\n });\n}\n\nconst nlSettingsKey = (workspaceId: string | null | undefined) =>\n ['semanticfed', 'nl', 'settings', workspaceId ?? 'no-workspace'] as const;\n\n/** The workspace's natural-language settings (LLM-assisted phrasing is off until enabled). */\nexport function useSemNlSettings() {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: nlSettingsKey(workspaceId),\n enabled: Boolean(workspaceId),\n queryFn: async () => {\n const data = await semRequest<{ semNlSettings: SemNlSettings }>(\n NL_SETTINGS_QUERY,\n {},\n apiGatewayUrl\n );\n return data.semNlSettings;\n },\n });\n}\n\n/** Save the workspace's natural-language settings (governance permission). */\nexport function useSemUpdateNlSettings() {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: SemUpdateNlSettingsInput) => {\n const data = await semRequest<{ semUpdateNlSettings: SemNlSettings }>(\n UPDATE_NL_SETTINGS_MUTATION,\n { input },\n apiGatewayUrl\n );\n return data.semUpdateNlSettings;\n },\n onSuccess: (settings) => {\n queryClient.setQueryData(nlSettingsKey(workspaceId), settings);\n },\n });\n}\n\ninterface ConnectionsData {\n getConnections: {\n items: Array<{\n id: string;\n name: string;\n status: string;\n provider: { key: string; name: string } | null;\n }>;\n };\n}\n\n/** Active integration connections to a supported AI provider (OpenAI, Anthropic). */\nexport function useSemAiConnections(enabled: boolean, supportedProviders: string[]) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: [\n 'semanticfed',\n 'nl',\n 'ai-connections',\n workspaceId ?? 'no-workspace',\n supportedProviders.join(','),\n ] as const,\n enabled: Boolean(workspaceId) && enabled,\n queryFn: async (): Promise<SemAiConnection[]> => {\n const data = await semRequest<ConnectionsData>(\n AI_CONNECTIONS_QUERY,\n { filter: { status: 'ACTIVE' }, pagination: { limit: 100 } },\n apiGatewayUrl\n );\n const supported = new Set(supportedProviders);\n return data.getConnections.items\n .filter((c) => c.provider && supported.has(c.provider.key))\n .map((c) => ({\n id: c.id,\n name: c.name,\n status: c.status,\n providerKey: c.provider?.key ?? '',\n providerName: c.provider?.name ?? '',\n }));\n },\n });\n}\n"],"mappings":";;;;AA0HA,IAAMA,IAAqB,kaA6BrBC,IAAkB,wJA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mBAAgBd,EAAe;CACtD,OAAOC,EAAS;EACd,UAAU;GACR;GACA;GACA;GACAC,KAAe;GACfa,EAAmB,KAAK,GAAG;EAC7B;EACA,SAAS,EAAQb,KAAgBc;EACjC,SAAS,YAAwC;GAC/C,IAAMC,IAAO,MAAMb,EACjBR,GACA;IAAE,QAAQ,EAAE,QAAQ,SAAS;IAAG,YAAY,EAAE,OAAO,IAAI;GAAE,GAC3DS,CACF,GACMa,IAAY,IAAI,IAAIH,CAAkB;GAC5C,OAAOE,EAAK,eAAe,MACxB,QAAQ,MAAME,EAAE,YAAYD,EAAU,IAAIC,EAAE,SAAS,GAAG,CAAC,CAAC,CAC1D,KAAK,OAAO;IACX,IAAIA,EAAE;IACN,MAAMA,EAAE;IACR,QAAQA,EAAE;IACV,aAAaA,EAAE,UAAU,OAAO;IAChC,cAAcA,EAAE,UAAU,QAAQ;GACpC,EAAE;EACN;CACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"useNlQuery.js","names":["TRANSLATION_FIELDS","SETTINGS_FIELDS","NL_SETTINGS_QUERY","UPDATE_NL_SETTINGS_MUTATION","AI_CONNECTIONS_QUERY","SUGGESTIONS_QUERY","ASK_QUESTION_MUTATION","useSemNlSuggestions","useSemanticFed","useQuery","workspaceId","modelId","semRequest","apiGatewayUrl","useSemAskQuestion","analytics","useClientAnalytics","useMutation","answer","nlSettingsKey","useSemNlSettings","useSemUpdateNlSettings","queryClient","useQueryClient","settings","useSemAiConnections","supportedProviders","enabled","data","supported","c"],"sources":["../../../src/semanticfed/hooks/useNlQuery.ts"],"sourcesContent":["/**\n * Natural-language question hooks (BOFF-4276), wired to the\n * `wspace-semanticfed-svc` NL module:\n *\n * - `semTranslateQuestion` translates a question into SQL over the model's\n * governed entities, dimensions and metrics without running it. Asked with\n * an empty question it returns only the example questions the model can\n * answer, which the console offers as starting points.\n * - `semAskQuestion` translates the question and runs the generated SQL\n * through the SQL endpoint with the caller's access policies applied. It is\n * metered as one query run.\n * - Follow-ups (BOFF-10533): the earlier questions of the conversation are\n * sent as `history`, so \"and by status?\" or \"only EU\" refine the previous\n * interpretation.\n * - LLM-assisted phrasing (BOFF-10533): `semNlSettings` /\n * `semUpdateNlSettings` turn on rewording by the workspace's own AI\n * provider (an OpenAI or Anthropic connection from Integrations).\n */\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { semRequest } from '../api/semanticfedGraphql';\nimport { useSemanticFed } from '../providers/SemanticFedProvider';\nimport { useClientAnalytics } from './useClientAnalytics';\nimport type { SemSqlResult } from './useSqlConsole';\n\nexport type SemNlStatus = 'TRANSLATED' | 'NEEDS_CLARIFICATION';\n\nexport type SemNlClarificationReason =\n | 'EMPTY_QUESTION'\n | 'TOO_LONG'\n | 'NO_MATCH'\n | 'NO_JOIN_PATH'\n | 'UNSUPPORTED_AGGREGATION'\n | 'INVALID_FILTER'\n | 'LOW_CONFIDENCE'\n | 'INVALID_QUERY'\n | 'UNPLACED_VALUE';\n\nexport type SemNlAssistStatus =\n | 'NOT_NEEDED'\n | 'SKIPPED'\n | 'DISABLED'\n | 'NOT_CONFIGURED'\n | 'QUOTA_EXHAUSTED'\n | 'QUOTA_UNAVAILABLE'\n | 'PROVIDER_ERROR'\n | 'NO_IMPROVEMENT'\n | 'REPHRASED';\n\nexport type SemNlStepKind =\n 'ENTITY' | 'JOIN' | 'COLUMN' | 'MEASURE' | 'GROUP_BY' | 'FILTER' | 'ORDER' | 'LIMIT';\n\nexport interface SemNlStep {\n kind: SemNlStepKind;\n entity: string | null;\n field: string | null;\n aggregation: string | null;\n governed: boolean;\n operator: string | null;\n value: unknown;\n direction: string | null;\n count: number | null;\n relationship: string | null;\n}\n\nexport interface SemNlTranslation {\n modelId: string;\n modelName: string;\n question: string;\n status: SemNlStatus;\n sql: string | null;\n confidence: number;\n steps: SemNlStep[];\n unmatchedTerms: string[];\n clarificationReason: SemNlClarificationReason | null;\n clarification: string | null;\n suggestions: string[];\n engine: string;\n followUp: boolean;\n assist: SemNlAssistStatus;\n rephrasedQuestion: string | null;\n assistProvider: string | null;\n}\n\nexport interface SemNlAnswer {\n translation: SemNlTranslation;\n result: SemSqlResult | null;\n}\n\nexport interface SemNlQuestionInput {\n question: string;\n modelId: string;\n maxRows?: number;\n /** Earlier questions of the conversation, oldest first. */\n history?: string[];\n}\n\nexport interface SemNlSettings {\n llmAssistEnabled: boolean;\n aiConnectionId: string | null;\n aiProviderKey: string | null;\n aiModel: string | null;\n defaultAiModel: string | null;\n supportedProviders: string[];\n updatedAt: string | null;\n updatedBy: string | null;\n}\n\nexport interface SemUpdateNlSettingsInput {\n llmAssistEnabled: boolean;\n aiConnectionId: string | null;\n aiModel: string | null;\n}\n\n/** An integration connection that can hold the workspace's AI provider key. */\nexport interface SemAiConnection {\n id: string;\n name: string;\n status: string;\n providerKey: string;\n providerName: string;\n}\n\nconst TRANSLATION_FIELDS = `\n modelId\n modelName\n question\n status\n sql\n confidence\n steps {\n kind\n entity\n field\n aggregation\n governed\n operator\n value\n direction\n count\n relationship\n }\n unmatchedTerms\n clarificationReason\n clarification\n suggestions\n engine\n followUp\n assist\n rephrasedQuestion\n assistProvider`;\n\nconst SETTINGS_FIELDS = `\n llmAssistEnabled\n aiConnectionId\n aiProviderKey\n aiModel\n defaultAiModel\n supportedProviders\n updatedAt\n updatedBy`;\n\nconst NL_SETTINGS_QUERY = `query SemNlSettings {\n semNlSettings {${SETTINGS_FIELDS}\n }\n}`;\n\nconst UPDATE_NL_SETTINGS_MUTATION = `mutation SemUpdateNlSettings($input: SemUpdateNlSettingsInput!) {\n semUpdateNlSettings(input: $input) {${SETTINGS_FIELDS}\n }\n}`;\n\nconst AI_CONNECTIONS_QUERY = `query SemAiConnections($filter: ConnectionFilterInput, $pagination: IntegrationsPaginationInput) {\n getConnections(filter: $filter, pagination: $pagination) {\n items {\n id\n name\n status\n provider {\n key\n name\n }\n }\n }\n}`;\n\nconst SUGGESTIONS_QUERY = `query SemNlSuggestions($input: SemNlQuestionInput!) {\n semTranslateQuestion(input: $input) {\n modelId\n suggestions\n }\n}`;\n\nconst ASK_QUESTION_MUTATION = `mutation SemAskQuestion($input: SemNlQuestionInput!) {\n semAskQuestion(input: $input) {\n translation {${TRANSLATION_FIELDS}\n }\n result {\n modelId\n columns {\n name\n entity\n field\n aggregation\n dataType\n masked\n mask\n }\n rows\n rowCount\n truncated\n durationMs\n sourcesTouched\n }\n }\n}`;\n\n/** Example questions the model can answer (translation only: reads no data, not metered). */\nexport function useSemNlSuggestions(modelId: string | null) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'nl', 'suggestions', workspaceId ?? 'no-workspace', modelId] as const,\n enabled: Boolean(workspaceId && modelId),\n queryFn: async () => {\n const data = await semRequest<{\n semTranslateQuestion: Pick<SemNlTranslation, 'modelId' | 'suggestions'>;\n }>(SUGGESTIONS_QUERY, { input: { question: '', modelId } }, apiGatewayUrl);\n return data.semTranslateQuestion.suggestions;\n },\n });\n}\n\n/** Translate a question and run it with the caller's access policies (one metered query run). */\nexport function useSemAskQuestion() {\n const { apiGatewayUrl } = useSemanticFed();\n const analytics = useClientAnalytics();\n return useMutation({\n mutationFn: async (input: SemNlQuestionInput) => {\n const data = await semRequest<{ semAskQuestion: SemNlAnswer }>(\n ASK_QUESTION_MUTATION,\n { input },\n apiGatewayUrl\n );\n const answer = data.semAskQuestion;\n analytics.nlAsked(\n answer.translation.status,\n Boolean(answer.result),\n answer.translation.followUp,\n answer.result?.durationMs ?? null\n );\n return answer;\n },\n });\n}\n\nconst nlSettingsKey = (workspaceId: string | null | undefined) =>\n ['semanticfed', 'nl', 'settings', workspaceId ?? 'no-workspace'] as const;\n\n/** The workspace's natural-language settings (LLM-assisted phrasing is off until enabled). */\nexport function useSemNlSettings() {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: nlSettingsKey(workspaceId),\n enabled: Boolean(workspaceId),\n queryFn: async () => {\n const data = await semRequest<{ semNlSettings: SemNlSettings }>(\n NL_SETTINGS_QUERY,\n {},\n apiGatewayUrl\n );\n return data.semNlSettings;\n },\n });\n}\n\n/** Save the workspace's natural-language settings (governance permission). */\nexport function useSemUpdateNlSettings() {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: SemUpdateNlSettingsInput) => {\n const data = await semRequest<{ semUpdateNlSettings: SemNlSettings }>(\n UPDATE_NL_SETTINGS_MUTATION,\n { input },\n apiGatewayUrl\n );\n return data.semUpdateNlSettings;\n },\n onSuccess: (settings) => {\n queryClient.setQueryData(nlSettingsKey(workspaceId), settings);\n },\n });\n}\n\ninterface ConnectionsData {\n getConnections: {\n items: Array<{\n id: string;\n name: string;\n status: string;\n provider: { key: string; name: string } | null;\n }>;\n };\n}\n\n/** Active integration connections to a supported AI provider (OpenAI, Anthropic). */\nexport function useSemAiConnections(enabled: boolean, supportedProviders: string[]) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: [\n 'semanticfed',\n 'nl',\n 'ai-connections',\n workspaceId ?? 'no-workspace',\n supportedProviders.join(','),\n ] as const,\n enabled: Boolean(workspaceId) && enabled,\n queryFn: async (): Promise<SemAiConnection[]> => {\n const data = await semRequest<ConnectionsData>(\n AI_CONNECTIONS_QUERY,\n { filter: { status: 'ACTIVE' }, pagination: { limit: 100 } },\n apiGatewayUrl\n );\n const supported = new Set(supportedProviders);\n return data.getConnections.items\n .filter((c) => c.provider && supported.has(c.provider.key))\n .map((c) => ({\n id: c.id,\n name: c.name,\n status: c.status,\n providerKey: c.provider?.key ?? '',\n providerName: c.provider?.name ?? '',\n }));\n },\n });\n}\n"],"mappings":";;;;;AA2HA,IAAMA,IAAqB,kaA6BrBC,IAAkB,wJAUlBC,IAAoB;mBACPD,EAAgB;;IAI7BE,IAA8B;wCACIF,EAAgB;;IAIlDG,IAAuB,0RAcvBC,IAAoB,wIAOpBC,IAAwB;;mBAEXN,EAAmB;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kB,GAA8B;CAClF,IAAM,EAAE,kBAAe,mBAAgBjB,EAAe;CACtD,OAAOC,EAAS;EACd,UAAU;GACR;GACA;GACA;GACAC,KAAe;GACfgB,EAAmB,KAAK,GAAG;EAC7B;EACA,SAAS,EAAQhB,KAAgBiB;EACjC,SAAS,YAAwC;GAC/C,IAAMC,IAAO,MAAMhB,EACjBR,GACA;IAAE,QAAQ,EAAE,QAAQ,SAAS;IAAG,YAAY,EAAE,OAAO,IAAI;GAAE,GAC3DS,CACF,GACMgB,IAAY,IAAI,IAAIH,CAAkB;GAC5C,OAAOE,EAAK,eAAe,MACxB,QAAQ,MAAME,EAAE,YAAYD,EAAU,IAAIC,EAAE,SAAS,GAAG,CAAC,CAAC,CAC1D,KAAK,OAAO;IACX,IAAIA,EAAE;IACN,MAAMA,EAAE;IACR,QAAQA,EAAE;IACV,aAAaA,EAAE,UAAU,OAAO;IAChC,cAAcA,EAAE,UAAU,QAAQ;GACpC,EAAE;EACN;CACF,CAAC;AACH"}
|
|
@@ -1,3 +1,53 @@
|
|
|
1
|
+
import { SemSavedQueryAnalyticsQuery } from '../../generated/wspace-operations';
|
|
2
|
+
export interface SemInteractionSummary {
|
|
3
|
+
totalCount: number;
|
|
4
|
+
succeededCount: number;
|
|
5
|
+
failedCount: number;
|
|
6
|
+
clarificationCount: number;
|
|
7
|
+
durationSamples: number;
|
|
8
|
+
averageDurationMs: number | null;
|
|
9
|
+
p50DurationMs: number | null;
|
|
10
|
+
p95DurationMs: number | null;
|
|
11
|
+
}
|
|
12
|
+
export interface SemAnalyticsFunnelStage {
|
|
13
|
+
stage: string;
|
|
14
|
+
completed: boolean;
|
|
15
|
+
count: number;
|
|
16
|
+
conversionRate: number;
|
|
17
|
+
}
|
|
18
|
+
export interface SemAnalyticsSegment {
|
|
19
|
+
segment: string;
|
|
20
|
+
totalInteractions: number;
|
|
21
|
+
directSqlCount: number;
|
|
22
|
+
nlQueryCount: number;
|
|
23
|
+
lineageCount: number;
|
|
24
|
+
catalogCount: number;
|
|
25
|
+
averageDurationMs: number | null;
|
|
26
|
+
}
|
|
27
|
+
export interface SemProductAnalyticsDay {
|
|
28
|
+
day: string;
|
|
29
|
+
savedRuns: number;
|
|
30
|
+
directSqlCount: number;
|
|
31
|
+
nlQueryCount: number;
|
|
32
|
+
lineageCount: number;
|
|
33
|
+
catalogCount: number;
|
|
34
|
+
totalInteractions: number;
|
|
35
|
+
durationSamples: number;
|
|
36
|
+
averageDurationMs: number | null;
|
|
37
|
+
}
|
|
38
|
+
export interface SemProductAnalytics {
|
|
39
|
+
windowDays: number;
|
|
40
|
+
from: string;
|
|
41
|
+
asOf: string;
|
|
42
|
+
savedQueries: NonNullable<SemSavedQueryAnalyticsQuery['semQueryAnalytics']>;
|
|
43
|
+
directSql: SemInteractionSummary;
|
|
44
|
+
nlQueries: SemInteractionSummary;
|
|
45
|
+
lineageInteractions: SemInteractionSummary;
|
|
46
|
+
catalogInteractions: SemInteractionSummary;
|
|
47
|
+
activationFunnel: SemAnalyticsFunnelStage[];
|
|
48
|
+
actorSegments: SemAnalyticsSegment[];
|
|
49
|
+
days: SemProductAnalyticsDay[];
|
|
50
|
+
}
|
|
1
51
|
/** One bounded read, bound to the actor and workspace that opened this page. */
|
|
2
52
|
export declare function useSemQueryAnalytics(days: 7 | 30): {
|
|
3
53
|
refresh: () => Promise<import('@tanstack/query-core').QueryObserverResult<{
|
|
@@ -507,3 +557,167 @@ export declare function useSemQueryAnalytics(days: 7 | 30): {
|
|
|
507
557
|
}, Error>>;
|
|
508
558
|
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
509
559
|
};
|
|
560
|
+
/** Reconciled workspace product analytics (direct SQL, NL, lineage, catalog, funnel & segments). */
|
|
561
|
+
export declare function useSemProductAnalytics(days: 7 | 30, enabled?: boolean): {
|
|
562
|
+
refresh: () => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
563
|
+
data: SemProductAnalytics;
|
|
564
|
+
error: Error;
|
|
565
|
+
isError: true;
|
|
566
|
+
isPending: false;
|
|
567
|
+
isLoading: false;
|
|
568
|
+
isLoadingError: false;
|
|
569
|
+
isRefetchError: true;
|
|
570
|
+
isSuccess: false;
|
|
571
|
+
isPlaceholderData: false;
|
|
572
|
+
status: "error";
|
|
573
|
+
dataUpdatedAt: number;
|
|
574
|
+
errorUpdatedAt: number;
|
|
575
|
+
failureCount: number;
|
|
576
|
+
failureReason: Error | null;
|
|
577
|
+
errorUpdateCount: number;
|
|
578
|
+
isFetched: boolean;
|
|
579
|
+
isFetchedAfterMount: boolean;
|
|
580
|
+
isFetching: boolean;
|
|
581
|
+
isInitialLoading: boolean;
|
|
582
|
+
isPaused: boolean;
|
|
583
|
+
isRefetching: boolean;
|
|
584
|
+
isStale: boolean;
|
|
585
|
+
isEnabled: boolean;
|
|
586
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
587
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
588
|
+
} | {
|
|
589
|
+
refresh: () => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
590
|
+
data: SemProductAnalytics;
|
|
591
|
+
error: null;
|
|
592
|
+
isError: false;
|
|
593
|
+
isPending: false;
|
|
594
|
+
isLoading: false;
|
|
595
|
+
isLoadingError: false;
|
|
596
|
+
isRefetchError: false;
|
|
597
|
+
isSuccess: true;
|
|
598
|
+
isPlaceholderData: false;
|
|
599
|
+
status: "success";
|
|
600
|
+
dataUpdatedAt: number;
|
|
601
|
+
errorUpdatedAt: number;
|
|
602
|
+
failureCount: number;
|
|
603
|
+
failureReason: Error | null;
|
|
604
|
+
errorUpdateCount: number;
|
|
605
|
+
isFetched: boolean;
|
|
606
|
+
isFetchedAfterMount: boolean;
|
|
607
|
+
isFetching: boolean;
|
|
608
|
+
isInitialLoading: boolean;
|
|
609
|
+
isPaused: boolean;
|
|
610
|
+
isRefetching: boolean;
|
|
611
|
+
isStale: boolean;
|
|
612
|
+
isEnabled: boolean;
|
|
613
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
614
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
615
|
+
} | {
|
|
616
|
+
refresh: () => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
617
|
+
data: undefined;
|
|
618
|
+
error: Error;
|
|
619
|
+
isError: true;
|
|
620
|
+
isPending: false;
|
|
621
|
+
isLoading: false;
|
|
622
|
+
isLoadingError: true;
|
|
623
|
+
isRefetchError: false;
|
|
624
|
+
isSuccess: false;
|
|
625
|
+
isPlaceholderData: false;
|
|
626
|
+
status: "error";
|
|
627
|
+
dataUpdatedAt: number;
|
|
628
|
+
errorUpdatedAt: number;
|
|
629
|
+
failureCount: number;
|
|
630
|
+
failureReason: Error | null;
|
|
631
|
+
errorUpdateCount: number;
|
|
632
|
+
isFetched: boolean;
|
|
633
|
+
isFetchedAfterMount: boolean;
|
|
634
|
+
isFetching: boolean;
|
|
635
|
+
isInitialLoading: boolean;
|
|
636
|
+
isPaused: boolean;
|
|
637
|
+
isRefetching: boolean;
|
|
638
|
+
isStale: boolean;
|
|
639
|
+
isEnabled: boolean;
|
|
640
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
641
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
642
|
+
} | {
|
|
643
|
+
refresh: () => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
644
|
+
data: undefined;
|
|
645
|
+
error: null;
|
|
646
|
+
isError: false;
|
|
647
|
+
isPending: true;
|
|
648
|
+
isLoading: true;
|
|
649
|
+
isLoadingError: false;
|
|
650
|
+
isRefetchError: false;
|
|
651
|
+
isSuccess: false;
|
|
652
|
+
isPlaceholderData: false;
|
|
653
|
+
status: "pending";
|
|
654
|
+
dataUpdatedAt: number;
|
|
655
|
+
errorUpdatedAt: number;
|
|
656
|
+
failureCount: number;
|
|
657
|
+
failureReason: Error | null;
|
|
658
|
+
errorUpdateCount: number;
|
|
659
|
+
isFetched: boolean;
|
|
660
|
+
isFetchedAfterMount: boolean;
|
|
661
|
+
isFetching: boolean;
|
|
662
|
+
isInitialLoading: boolean;
|
|
663
|
+
isPaused: boolean;
|
|
664
|
+
isRefetching: boolean;
|
|
665
|
+
isStale: boolean;
|
|
666
|
+
isEnabled: boolean;
|
|
667
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
668
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
669
|
+
} | {
|
|
670
|
+
refresh: () => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
671
|
+
data: undefined;
|
|
672
|
+
error: null;
|
|
673
|
+
isError: false;
|
|
674
|
+
isPending: true;
|
|
675
|
+
isLoadingError: false;
|
|
676
|
+
isRefetchError: false;
|
|
677
|
+
isSuccess: false;
|
|
678
|
+
isPlaceholderData: false;
|
|
679
|
+
status: "pending";
|
|
680
|
+
dataUpdatedAt: number;
|
|
681
|
+
errorUpdatedAt: number;
|
|
682
|
+
failureCount: number;
|
|
683
|
+
failureReason: Error | null;
|
|
684
|
+
errorUpdateCount: number;
|
|
685
|
+
isFetched: boolean;
|
|
686
|
+
isFetchedAfterMount: boolean;
|
|
687
|
+
isFetching: boolean;
|
|
688
|
+
isLoading: boolean;
|
|
689
|
+
isInitialLoading: boolean;
|
|
690
|
+
isPaused: boolean;
|
|
691
|
+
isRefetching: boolean;
|
|
692
|
+
isStale: boolean;
|
|
693
|
+
isEnabled: boolean;
|
|
694
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
695
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
696
|
+
} | {
|
|
697
|
+
refresh: () => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
698
|
+
data: SemProductAnalytics;
|
|
699
|
+
isError: false;
|
|
700
|
+
error: null;
|
|
701
|
+
isPending: false;
|
|
702
|
+
isLoading: false;
|
|
703
|
+
isLoadingError: false;
|
|
704
|
+
isRefetchError: false;
|
|
705
|
+
isSuccess: true;
|
|
706
|
+
isPlaceholderData: true;
|
|
707
|
+
status: "success";
|
|
708
|
+
dataUpdatedAt: number;
|
|
709
|
+
errorUpdatedAt: number;
|
|
710
|
+
failureCount: number;
|
|
711
|
+
failureReason: Error | null;
|
|
712
|
+
errorUpdateCount: number;
|
|
713
|
+
isFetched: boolean;
|
|
714
|
+
isFetchedAfterMount: boolean;
|
|
715
|
+
isFetching: boolean;
|
|
716
|
+
isInitialLoading: boolean;
|
|
717
|
+
isPaused: boolean;
|
|
718
|
+
isRefetching: boolean;
|
|
719
|
+
isStale: boolean;
|
|
720
|
+
isEnabled: boolean;
|
|
721
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SemProductAnalytics, Error>>;
|
|
722
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
723
|
+
};
|
|
@@ -5,8 +5,8 @@ import { useQuery as r } from "@tanstack/react-query";
|
|
|
5
5
|
import { clearGraphqlFetchResponseCache as i, graphqlFetchPinned as a, prepareWorkspaceRequest as o, resolveGatewayUrl as s } from "@burdenoff/fe-libs/shared/graphql";
|
|
6
6
|
import { print as c } from "graphql";
|
|
7
7
|
// src/semanticfed/hooks/useQueryAnalytics.ts
|
|
8
|
-
var l = c(e);
|
|
9
|
-
function
|
|
8
|
+
var l = c(e), u = "query SemProductAnalytics($days: Int!) {\n semProductAnalytics(days: $days) {\n windowDays\n from\n asOf\n directSql {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n nlQueries {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n lineageInteractions {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n catalogInteractions {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n activationFunnel {\n stage\n completed\n count\n conversionRate\n }\n actorSegments {\n segment\n totalInteractions\n directSqlCount\n nlQueryCount\n lineageCount\n catalogCount\n averageDurationMs\n }\n days {\n day\n savedRuns\n directSqlCount\n nlQueryCount\n lineageCount\n catalogCount\n totalInteractions\n durationSamples\n averageDurationMs\n }\n }\n}";
|
|
9
|
+
function d(e) {
|
|
10
10
|
let { currentUser: c, organizationId: u, tenantId: d, workspaceId: f, apiGatewayUrl: p, authToken: m, workspaceToken: h } = n(), g = r({
|
|
11
11
|
queryKey: [
|
|
12
12
|
"semanticfed",
|
|
@@ -60,6 +60,60 @@ function u(e) {
|
|
|
60
60
|
refresh: () => (i(), g.refetch())
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
function f(e, c = !0) {
|
|
64
|
+
let { currentUser: l, organizationId: d, tenantId: f, workspaceId: p, apiGatewayUrl: m, authToken: h, workspaceToken: g } = n(), _ = r({
|
|
65
|
+
queryKey: [
|
|
66
|
+
"semanticfed",
|
|
67
|
+
"productAnalytics",
|
|
68
|
+
l?.id ?? "",
|
|
69
|
+
d ?? "",
|
|
70
|
+
f ?? "",
|
|
71
|
+
p ?? "",
|
|
72
|
+
m ?? "",
|
|
73
|
+
e
|
|
74
|
+
],
|
|
75
|
+
enabled: c && !!(l?.id && d && p && h),
|
|
76
|
+
staleTime: 3e4,
|
|
77
|
+
retry: !1,
|
|
78
|
+
queryFn: async ({ signal: n }) => {
|
|
79
|
+
if (!l?.id || !d || !p || !h) throw Error("ANALYTICS_CONTEXT_REQUIRED");
|
|
80
|
+
let r = await o({
|
|
81
|
+
url: s("workspace", m),
|
|
82
|
+
authToken: h,
|
|
83
|
+
actorId: l.id,
|
|
84
|
+
workspaceId: p,
|
|
85
|
+
tenantId: f,
|
|
86
|
+
workspaceToken: g,
|
|
87
|
+
currentQuery: u,
|
|
88
|
+
signal: n
|
|
89
|
+
});
|
|
90
|
+
r.assertCurrent();
|
|
91
|
+
let i = await a({
|
|
92
|
+
gateway: "workspace",
|
|
93
|
+
baseUrl: m,
|
|
94
|
+
query: u,
|
|
95
|
+
operationName: "SemProductAnalytics",
|
|
96
|
+
variables: { days: e },
|
|
97
|
+
authToken: h,
|
|
98
|
+
workspaceToken: r.workspaceToken,
|
|
99
|
+
workspaceId: p,
|
|
100
|
+
organizationId: d,
|
|
101
|
+
tenantId: f,
|
|
102
|
+
signal: n
|
|
103
|
+
});
|
|
104
|
+
if (r.assertCurrent(), i.errors?.length) {
|
|
105
|
+
let e = i.errors[0];
|
|
106
|
+
throw new t(e?.message ?? "Product analytics request failed", typeof e?.extensions?.code == "string" ? e.extensions.code : void 0, void 0);
|
|
107
|
+
}
|
|
108
|
+
if (!i.data?.semProductAnalytics) throw Error("PRODUCT_ANALYTICS_RESPONSE_MISSING");
|
|
109
|
+
return i.data.semProductAnalytics;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
..._,
|
|
114
|
+
refresh: () => (i(), _.refetch())
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export { f as useSemProductAnalytics, d as useSemQueryAnalytics };
|
|
64
118
|
|
|
65
119
|
//# sourceMappingURL=useQueryAnalytics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQueryAnalytics.js","names":["ANALYTICS_QUERY","print","SemSavedQueryAnalyticsDocument","useSemQueryAnalytics","useSemanticFed","query","useQuery","currentUser","organizationId","tenantId","workspaceId","apiGatewayUrl","days","authToken","intent","prepareWorkspaceRequest","resolveGatewayUrl","response","graphqlFetchPinned","error","SemRequestError","clearGraphqlFetchResponseCache"],"sources":["../../../src/semanticfed/hooks/useQueryAnalytics.ts"],"sourcesContent":["import {\n clearGraphqlFetchResponseCache,\n graphqlFetchPinned,\n prepareWorkspaceRequest,\n resolveGatewayUrl,\n} from '@burdenoff/fe-libs/shared/graphql';\nimport { useQuery } from '@tanstack/react-query';\nimport { print } from 'graphql';\n\nimport {\n SemSavedQueryAnalyticsDocument,\n type SemSavedQueryAnalyticsQuery,\n} from '../../generated/wspace-operations';\nimport { SemRequestError } from '../api/semanticfedGraphql';\nimport { useSemanticFed } from '../providers/SemanticFedProvider';\n\nconst ANALYTICS_QUERY = print(SemSavedQueryAnalyticsDocument);\n\n/** One bounded read, bound to the actor and workspace that opened this page. */\nexport function useSemQueryAnalytics(days: 7 | 30) {\n const {\n currentUser,\n organizationId,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n workspaceToken,\n } = useSemanticFed();\n const query = useQuery({\n // Credentials must never be stored in cache keys or developer-tool metadata.\n queryKey: [\n 'semanticfed',\n 'queryAnalytics',\n currentUser?.id ?? '',\n organizationId ?? '',\n tenantId ?? '',\n workspaceId ?? '',\n apiGatewayUrl ?? '',\n days,\n ] as const,\n enabled: Boolean(currentUser?.id && organizationId && workspaceId && authToken),\n staleTime: 30_000,\n retry: false,\n queryFn: async ({ signal }) => {\n if (!currentUser?.id || !organizationId || !workspaceId || !authToken) {\n throw new Error('ANALYTICS_CONTEXT_REQUIRED');\n }\n const intent = await prepareWorkspaceRequest({\n url: resolveGatewayUrl('workspace', apiGatewayUrl),\n authToken,\n actorId: currentUser.id,\n workspaceId,\n tenantId,\n workspaceToken,\n currentQuery: ANALYTICS_QUERY,\n signal,\n });\n intent.assertCurrent();\n const response = await graphqlFetchPinned<SemSavedQueryAnalyticsQuery>({\n gateway: 'workspace',\n baseUrl: apiGatewayUrl,\n query: ANALYTICS_QUERY,\n operationName: 'SemSavedQueryAnalytics',\n variables: { days },\n authToken,\n workspaceToken: intent.workspaceToken,\n workspaceId,\n organizationId,\n tenantId,\n signal,\n });\n intent.assertCurrent();\n if (response.errors?.length) {\n const error = response.errors[0];\n throw new SemRequestError(\n error?.message ?? 'Analytics request failed',\n typeof error?.extensions?.code === 'string' ? error.extensions.code : undefined,\n undefined\n );\n }\n if (!response.data?.semQueryAnalytics) throw new Error('ANALYTICS_RESPONSE_MISSING');\n return response.data.semQueryAnalytics;\n },\n });\n return {\n ...query,\n refresh: () => {\n clearGraphqlFetchResponseCache();\n return query.refetch();\n },\n };\n}\n"],"mappings":";;;;;;;AAgBA,IAAMA,IAAkBC,EAAMC,CAA8B;AAG5D,SAAgBC,EAAqB,GAAc;CACjD,IAAM,EACJ,gBACA,mBACA,aACA,gBACA,kBACA,cACA,sBACEC,EAAe,GACbC,IAAQC,EAAS;EAErB,UAAU;GACR;GACA;GACAC,GAAa,MAAM;GACnBC,KAAkB;GAClBC,KAAY;GACZC,KAAe;GACfC,KAAiB;GACjBC;EACF;EACA,SAAS,GAAQL,GAAa,MAAMC,KAAkBE,KAAeG;EACrE,WAAW;EACX,OAAO;EACP,SAAS,OAAO,EAAE,gBAAa;GAC7B,IAAI,CAACN,GAAa,MAAM,CAACC,KAAkB,CAACE,KAAe,CAACG,GAC1D,MAAU,MAAM,4BAA4B;GAE9C,IAAMC,IAAS,MAAMC,EAAwB;IAC3C,KAAKC,EAAkB,aAAaL,CAAa;IACjD;IACA,SAASJ,EAAY;IACrB;IACA;IACA;IACA,cAAcP;IACd;GACF,CAAC;GACD,EAAO,cAAc;GACrB,IAAMiB,IAAW,MAAMC,EAAgD;IACrE,SAAS;IACT,SAASP;IACT,OAAOX;IACP,eAAe;IACf,WAAW,EAAE,QAAK;IAClB;IACA,gBAAgBc,EAAO;IACvB;IACA;IACA;IACA;GACF,CAAC;GAED,IADAA,EAAO,cAAc,GACjBG,EAAS,QAAQ,QAAQ;IAC3B,IAAME,IAAQF,EAAS,OAAO;IAC9B,MAAM,IAAIG,EACRD,GAAO,WAAW,4BAClB,OAAOA,GAAO,YAAY,QAAS,WAAWA,EAAM,WAAW,OAAO,KAAA,GACtE,KAAA,CACF;GACF;GACA,IAAI,CAACF,EAAS,MAAM,mBAAmB,MAAU,MAAM,4BAA4B;GACnF,OAAOA,EAAS,KAAK;EACvB;CACF,CAAC;CACD,OAAO;EACL,GAAGZ;EACH,gBACEgB,EAA+B,GACxBhB,EAAM,QAAQ;CAEzB;AACF"}
|
|
1
|
+
{"version":3,"file":"useQueryAnalytics.js","names":["ANALYTICS_QUERY","print","SemSavedQueryAnalyticsDocument","PRODUCT_ANALYTICS_QUERY","useSemQueryAnalytics","useSemanticFed","query","useQuery","currentUser","organizationId","tenantId","workspaceId","apiGatewayUrl","days","authToken","intent","prepareWorkspaceRequest","resolveGatewayUrl","response","graphqlFetchPinned","error","SemRequestError","clearGraphqlFetchResponseCache","useSemProductAnalytics","enabled"],"sources":["../../../src/semanticfed/hooks/useQueryAnalytics.ts"],"sourcesContent":["import {\n clearGraphqlFetchResponseCache,\n graphqlFetchPinned,\n prepareWorkspaceRequest,\n resolveGatewayUrl,\n} from '@burdenoff/fe-libs/shared/graphql';\nimport { useQuery } from '@tanstack/react-query';\nimport { print } from 'graphql';\n\nimport {\n SemSavedQueryAnalyticsDocument,\n type SemSavedQueryAnalyticsQuery,\n} from '../../generated/wspace-operations';\nimport { SemRequestError } from '../api/semanticfedGraphql';\nimport { useSemanticFed } from '../providers/SemanticFedProvider';\n\nconst ANALYTICS_QUERY = print(SemSavedQueryAnalyticsDocument);\n\nexport interface SemInteractionSummary {\n totalCount: number;\n succeededCount: number;\n failedCount: number;\n clarificationCount: number;\n durationSamples: number;\n averageDurationMs: number | null;\n p50DurationMs: number | null;\n p95DurationMs: number | null;\n}\n\nexport interface SemAnalyticsFunnelStage {\n stage: string;\n completed: boolean;\n count: number;\n conversionRate: number;\n}\n\nexport interface SemAnalyticsSegment {\n segment: string;\n totalInteractions: number;\n directSqlCount: number;\n nlQueryCount: number;\n lineageCount: number;\n catalogCount: number;\n averageDurationMs: number | null;\n}\n\nexport interface SemProductAnalyticsDay {\n day: string;\n savedRuns: number;\n directSqlCount: number;\n nlQueryCount: number;\n lineageCount: number;\n catalogCount: number;\n totalInteractions: number;\n durationSamples: number;\n averageDurationMs: number | null;\n}\n\nexport interface SemProductAnalytics {\n windowDays: number;\n from: string;\n asOf: string;\n savedQueries: NonNullable<SemSavedQueryAnalyticsQuery['semQueryAnalytics']>;\n directSql: SemInteractionSummary;\n nlQueries: SemInteractionSummary;\n lineageInteractions: SemInteractionSummary;\n catalogInteractions: SemInteractionSummary;\n activationFunnel: SemAnalyticsFunnelStage[];\n actorSegments: SemAnalyticsSegment[];\n days: SemProductAnalyticsDay[];\n}\n\nconst PRODUCT_ANALYTICS_QUERY = `query SemProductAnalytics($days: Int!) {\n semProductAnalytics(days: $days) {\n windowDays\n from\n asOf\n directSql {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n nlQueries {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n lineageInteractions {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n catalogInteractions {\n totalCount\n succeededCount\n failedCount\n clarificationCount\n durationSamples\n averageDurationMs\n p50DurationMs\n p95DurationMs\n }\n activationFunnel {\n stage\n completed\n count\n conversionRate\n }\n actorSegments {\n segment\n totalInteractions\n directSqlCount\n nlQueryCount\n lineageCount\n catalogCount\n averageDurationMs\n }\n days {\n day\n savedRuns\n directSqlCount\n nlQueryCount\n lineageCount\n catalogCount\n totalInteractions\n durationSamples\n averageDurationMs\n }\n }\n}`;\n\n/** One bounded read, bound to the actor and workspace that opened this page. */\nexport function useSemQueryAnalytics(days: 7 | 30) {\n const {\n currentUser,\n organizationId,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n workspaceToken,\n } = useSemanticFed();\n const query = useQuery({\n // Credentials must never be stored in cache keys or developer-tool metadata.\n queryKey: [\n 'semanticfed',\n 'queryAnalytics',\n currentUser?.id ?? '',\n organizationId ?? '',\n tenantId ?? '',\n workspaceId ?? '',\n apiGatewayUrl ?? '',\n days,\n ] as const,\n enabled: Boolean(currentUser?.id && organizationId && workspaceId && authToken),\n staleTime: 30_000,\n retry: false,\n queryFn: async ({ signal }) => {\n if (!currentUser?.id || !organizationId || !workspaceId || !authToken) {\n throw new Error('ANALYTICS_CONTEXT_REQUIRED');\n }\n const intent = await prepareWorkspaceRequest({\n url: resolveGatewayUrl('workspace', apiGatewayUrl),\n authToken,\n actorId: currentUser.id,\n workspaceId,\n tenantId,\n workspaceToken,\n currentQuery: ANALYTICS_QUERY,\n signal,\n });\n intent.assertCurrent();\n const response = await graphqlFetchPinned<SemSavedQueryAnalyticsQuery>({\n gateway: 'workspace',\n baseUrl: apiGatewayUrl,\n query: ANALYTICS_QUERY,\n operationName: 'SemSavedQueryAnalytics',\n variables: { days },\n authToken,\n workspaceToken: intent.workspaceToken,\n workspaceId,\n organizationId,\n tenantId,\n signal,\n });\n intent.assertCurrent();\n if (response.errors?.length) {\n const error = response.errors[0];\n throw new SemRequestError(\n error?.message ?? 'Analytics request failed',\n typeof error?.extensions?.code === 'string' ? error.extensions.code : undefined,\n undefined\n );\n }\n if (!response.data?.semQueryAnalytics) throw new Error('ANALYTICS_RESPONSE_MISSING');\n return response.data.semQueryAnalytics;\n },\n });\n return {\n ...query,\n refresh: () => {\n clearGraphqlFetchResponseCache();\n return query.refetch();\n },\n };\n}\n\n/** Reconciled workspace product analytics (direct SQL, NL, lineage, catalog, funnel & segments). */\nexport function useSemProductAnalytics(days: 7 | 30, enabled = true) {\n const {\n currentUser,\n organizationId,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n workspaceToken,\n } = useSemanticFed();\n const query = useQuery({\n queryKey: [\n 'semanticfed',\n 'productAnalytics',\n currentUser?.id ?? '',\n organizationId ?? '',\n tenantId ?? '',\n workspaceId ?? '',\n apiGatewayUrl ?? '',\n days,\n ] as const,\n enabled: enabled && Boolean(currentUser?.id && organizationId && workspaceId && authToken),\n staleTime: 30_000,\n retry: false,\n queryFn: async ({ signal }) => {\n if (!currentUser?.id || !organizationId || !workspaceId || !authToken) {\n throw new Error('ANALYTICS_CONTEXT_REQUIRED');\n }\n const intent = await prepareWorkspaceRequest({\n url: resolveGatewayUrl('workspace', apiGatewayUrl),\n authToken,\n actorId: currentUser.id,\n workspaceId,\n tenantId,\n workspaceToken,\n currentQuery: PRODUCT_ANALYTICS_QUERY,\n signal,\n });\n intent.assertCurrent();\n const response = await graphqlFetchPinned<{ semProductAnalytics: SemProductAnalytics }>({\n gateway: 'workspace',\n baseUrl: apiGatewayUrl,\n query: PRODUCT_ANALYTICS_QUERY,\n operationName: 'SemProductAnalytics',\n variables: { days },\n authToken,\n workspaceToken: intent.workspaceToken,\n workspaceId,\n organizationId,\n tenantId,\n signal,\n });\n intent.assertCurrent();\n if (response.errors?.length) {\n const error = response.errors[0];\n throw new SemRequestError(\n error?.message ?? 'Product analytics request failed',\n typeof error?.extensions?.code === 'string' ? error.extensions.code : undefined,\n undefined\n );\n }\n if (!response.data?.semProductAnalytics)\n throw new Error('PRODUCT_ANALYTICS_RESPONSE_MISSING');\n return response.data.semProductAnalytics;\n },\n });\n return {\n ...query,\n refresh: () => {\n clearGraphqlFetchResponseCache();\n return query.refetch();\n },\n };\n}\n"],"mappings":";;;;;;;AAgBA,IAAMA,IAAkBC,EAAMC,CAA8B,GAwDtDC,IAA0B;AA2EhC,SAAgBC,EAAqB,GAAc;CACjD,IAAM,EACJ,gBACA,mBACA,aACA,gBACA,kBACA,cACA,sBACEC,EAAe,GACbC,IAAQC,EAAS;EAErB,UAAU;GACR;GACA;GACAC,GAAa,MAAM;GACn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