@burdenoff/microfe-semanticfed 2026.1101.1 → 2026.1109.2

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 (136) hide show
  1. package/dist/dev/main.d.ts +0 -0
  2. package/dist/generated/global-operations.d.ts +4 -0
  3. package/dist/generated/global-types.d.ts +27295 -0
  4. package/dist/generated/wspace-operations.d.ts +73 -0
  5. package/dist/generated/wspace-operations.js +34 -0
  6. package/dist/generated/wspace-operations.js.map +1 -0
  7. package/dist/generated/wspace-types.d.ts +189763 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/node_modules/clsx/dist/clsx.js +8 -7
  10. package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
  11. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +229 -167
  12. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
  13. package/dist/semanticfed/SemanticFedRoot.d.ts +3 -0
  14. package/dist/semanticfed/SemanticFedRoot.js +5 -4
  15. package/dist/semanticfed/SemanticFedRoot.js.map +1 -1
  16. package/dist/semanticfed/SemanticFedRoutes.d.ts +1 -0
  17. package/dist/semanticfed/SemanticFedRoutes.js +1 -2
  18. package/dist/semanticfed/SemanticFedRoutes.js.map +1 -1
  19. package/dist/semanticfed/api/quotaRefusal.d.ts +46 -0
  20. package/dist/semanticfed/api/quotaRefusal.js +18 -19
  21. package/dist/semanticfed/api/quotaRefusal.js.map +1 -1
  22. package/dist/semanticfed/api/semanticfedGraphql.d.ts +14 -0
  23. package/dist/semanticfed/api/semanticfedGraphql.js +1 -2
  24. package/dist/semanticfed/api/semanticfedGraphql.js.map +1 -1
  25. package/dist/semanticfed/components/AskQuestionPanel.d.ts +35 -0
  26. package/dist/semanticfed/components/AskQuestionPanel.js +45 -46
  27. package/dist/semanticfed/components/AskQuestionPanel.js.map +1 -1
  28. package/dist/semanticfed/components/NlAssistSettings.d.ts +9 -0
  29. package/dist/semanticfed/components/NlAssistSettings.js +14 -15
  30. package/dist/semanticfed/components/NlAssistSettings.js.map +1 -1
  31. package/dist/semanticfed/components/OnboardingChecklist.d.ts +2 -0
  32. package/dist/semanticfed/components/OnboardingChecklist.js +1 -2
  33. package/dist/semanticfed/components/OnboardingChecklist.js.map +1 -1
  34. package/dist/semanticfed/components/SavedQueryRunsPanel.d.ts +11 -0
  35. package/dist/semanticfed/components/SavedQueryRunsPanel.js +109 -110
  36. package/dist/semanticfed/components/SavedQueryRunsPanel.js.map +1 -1
  37. package/dist/semanticfed/hooks/useLineage.d.ts +45 -0
  38. package/dist/semanticfed/hooks/useLineage.js +15 -16
  39. package/dist/semanticfed/hooks/useLineage.js.map +1 -1
  40. package/dist/semanticfed/hooks/useNlQuery.d.ts +79 -0
  41. package/dist/semanticfed/hooks/useNlQuery.js +13 -14
  42. package/dist/semanticfed/hooks/useNlQuery.js.map +1 -1
  43. package/dist/semanticfed/hooks/useOnboarding.d.ts +30 -0
  44. package/dist/semanticfed/hooks/useOnboarding.js +9 -10
  45. package/dist/semanticfed/hooks/useOnboarding.js.map +1 -1
  46. package/dist/semanticfed/hooks/useQueryAnalytics.d.ts +509 -0
  47. package/dist/semanticfed/hooks/useQueryAnalytics.js +65 -0
  48. package/dist/semanticfed/hooks/useQueryAnalytics.js.map +1 -0
  49. package/dist/semanticfed/hooks/useQueryRuns.d.ts +97 -0
  50. package/dist/semanticfed/hooks/useQueryRuns.js +54 -55
  51. package/dist/semanticfed/hooks/useQueryRuns.js.map +1 -1
  52. package/dist/semanticfed/hooks/useSqlConsole.d.ts +58 -0
  53. package/dist/semanticfed/hooks/useSqlConsole.js +14 -15
  54. package/dist/semanticfed/hooks/useSqlConsole.js.map +1 -1
  55. package/dist/semanticfed/hooks/useTr.d.ts +16 -0
  56. package/dist/semanticfed/hooks/useTr.js +1 -2
  57. package/dist/semanticfed/hooks/useTr.js.map +1 -1
  58. package/dist/semanticfed/index.d.ts +4 -0
  59. package/dist/semanticfed/index.js +4 -3
  60. package/dist/semanticfed/pages/AgentsPage.d.ts +2 -0
  61. package/dist/semanticfed/pages/AgentsPage.js +6 -7
  62. package/dist/semanticfed/pages/AgentsPage.js.map +1 -1
  63. package/dist/semanticfed/pages/AnalyticsPage.d.ts +1 -0
  64. package/dist/semanticfed/pages/AnalyticsPage.js +188 -203
  65. package/dist/semanticfed/pages/AnalyticsPage.js.map +1 -1
  66. package/dist/semanticfed/pages/AuditPage.d.ts +2 -0
  67. package/dist/semanticfed/pages/AuditPage.js +7 -8
  68. package/dist/semanticfed/pages/AuditPage.js.map +1 -1
  69. package/dist/semanticfed/pages/CollaborationPage.d.ts +2 -0
  70. package/dist/semanticfed/pages/CollaborationPage.js +4 -5
  71. package/dist/semanticfed/pages/CollaborationPage.js.map +1 -1
  72. package/dist/semanticfed/pages/ConfigurationPage.d.ts +2 -0
  73. package/dist/semanticfed/pages/ConfigurationPage.js +4 -5
  74. package/dist/semanticfed/pages/ConfigurationPage.js.map +1 -1
  75. package/dist/semanticfed/pages/DashboardPage.d.ts +1 -0
  76. package/dist/semanticfed/pages/DashboardPage.js +13 -14
  77. package/dist/semanticfed/pages/DashboardPage.js.map +1 -1
  78. package/dist/semanticfed/pages/DeploymentPage.d.ts +2 -0
  79. package/dist/semanticfed/pages/DeploymentPage.js +10 -11
  80. package/dist/semanticfed/pages/DeploymentPage.js.map +1 -1
  81. package/dist/semanticfed/pages/KnowledgeGraphPage.d.ts +1 -0
  82. package/dist/semanticfed/pages/KnowledgeGraphPage.js +9 -10
  83. package/dist/semanticfed/pages/KnowledgeGraphPage.js.map +1 -1
  84. package/dist/semanticfed/pages/LineagePage.d.ts +1 -0
  85. package/dist/semanticfed/pages/LineagePage.js +11 -12
  86. package/dist/semanticfed/pages/LineagePage.js.map +1 -1
  87. package/dist/semanticfed/pages/MonitoringPage.d.ts +1 -0
  88. package/dist/semanticfed/pages/MonitoringPage.js +13 -14
  89. package/dist/semanticfed/pages/MonitoringPage.js.map +1 -1
  90. package/dist/semanticfed/pages/OntologyPage.d.ts +1 -0
  91. package/dist/semanticfed/pages/OntologyPage.js +8 -9
  92. package/dist/semanticfed/pages/OntologyPage.js.map +1 -1
  93. package/dist/semanticfed/pages/PerformancePage.d.ts +2 -0
  94. package/dist/semanticfed/pages/PerformancePage.js +13 -14
  95. package/dist/semanticfed/pages/PerformancePage.js.map +1 -1
  96. package/dist/semanticfed/pages/PoliciesPage.d.ts +2 -0
  97. package/dist/semanticfed/pages/PoliciesPage.js +13 -14
  98. package/dist/semanticfed/pages/PoliciesPage.js.map +1 -1
  99. package/dist/semanticfed/pages/ProtocolPage.d.ts +1 -0
  100. package/dist/semanticfed/pages/ProtocolPage.js +6 -7
  101. package/dist/semanticfed/pages/ProtocolPage.js.map +1 -1
  102. package/dist/semanticfed/pages/QueryConsolePage.d.ts +1 -0
  103. package/dist/semanticfed/pages/QueryConsolePage.js +19 -20
  104. package/dist/semanticfed/pages/QueryConsolePage.js.map +1 -1
  105. package/dist/semanticfed/pages/RegistryPage.d.ts +1 -0
  106. package/dist/semanticfed/pages/RegistryPage.js +12 -13
  107. package/dist/semanticfed/pages/RegistryPage.js.map +1 -1
  108. package/dist/semanticfed/pages/TechStackPage.d.ts +2 -0
  109. package/dist/semanticfed/pages/TechStackPage.js +4 -5
  110. package/dist/semanticfed/pages/TechStackPage.js.map +1 -1
  111. package/dist/semanticfed/pages/TopologyPage.d.ts +2 -0
  112. package/dist/semanticfed/pages/TopologyPage.js +10 -11
  113. package/dist/semanticfed/pages/TopologyPage.js.map +1 -1
  114. package/dist/semanticfed/pages/VisualizationPage.d.ts +2 -0
  115. package/dist/semanticfed/pages/VisualizationPage.js +4 -5
  116. package/dist/semanticfed/pages/VisualizationPage.js.map +1 -1
  117. package/dist/semanticfed/providers/SemanticFedProvider.d.ts +4 -0
  118. package/dist/semanticfed/providers/SemanticFedProvider.js +9 -4
  119. package/dist/semanticfed/providers/SemanticFedProvider.js.map +1 -1
  120. package/dist/semanticfed/store/semanticfedStore.d.ts +44 -0
  121. package/dist/semanticfed/store/semanticfedStore.js +1 -2
  122. package/dist/semanticfed/store/semanticfedStore.js.map +1 -1
  123. package/dist/semanticfed/types/index.d.ts +209 -0
  124. package/dist/semanticfed/utils/cn.d.ts +2 -0
  125. package/dist/semanticfed/utils/cn.js +2 -3
  126. package/dist/semanticfed/utils/cn.js.map +1 -1
  127. package/dist/semanticfed/utils/format.d.ts +2 -0
  128. package/dist/semanticfed/utils/format.js +1 -2
  129. package/dist/semanticfed/utils/format.js.map +1 -1
  130. package/dist/semanticfed/utils/i18n.d.ts +4 -0
  131. package/dist/semanticfed/utils/i18n.js +1 -2
  132. package/dist/semanticfed/utils/i18n.js.map +1 -1
  133. package/dist/semanticfed/utils/navigation.d.ts +1 -0
  134. package/dist/semanticfed/utils/navigation.js +1 -2
  135. package/dist/semanticfed/utils/navigation.js.map +1 -1
  136. package/package.json +52 -39
@@ -0,0 +1,97 @@
1
+ export type SemQueryRunStatus = 'QUEUED' | 'PLANNING' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED';
2
+ export type SemSavedQueryStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';
3
+ export interface SemSavedQuery {
4
+ id: string;
5
+ name: string;
6
+ description: string | null;
7
+ modelId: string | null;
8
+ queryText: string;
9
+ status: SemSavedQueryStatus;
10
+ tags: string[];
11
+ updatedAt: string;
12
+ }
13
+ export interface SemQueryRun {
14
+ id: string;
15
+ queryId: string;
16
+ status: SemQueryRunStatus;
17
+ errorMessage: string | null;
18
+ planSummary: unknown;
19
+ rowCount: number | null;
20
+ durationMs: number | null;
21
+ sourcesTouched: number;
22
+ fromCache: boolean;
23
+ runById: string | null;
24
+ createdAt: string;
25
+ startedAt: string | null;
26
+ finishedAt: string | null;
27
+ }
28
+ export interface SemQueryRunResultColumn {
29
+ name: string;
30
+ entity: string;
31
+ field: string;
32
+ aggregation: string | null;
33
+ masked: boolean;
34
+ mask: string | null;
35
+ }
36
+ export interface SemQueryRunResultPage {
37
+ runId: string;
38
+ queryId: string;
39
+ columns: SemQueryRunResultColumn[];
40
+ rows: Array<Record<string, unknown>>;
41
+ rowCount: number;
42
+ totalRowCount: number;
43
+ truncated: boolean;
44
+ offset: number;
45
+ limit: number;
46
+ nextOffset: number | null;
47
+ expiresAt: string;
48
+ }
49
+ /** Rows per results page (the service allows up to 500). */
50
+ export declare const RUN_RESULT_PAGE_SIZE = 100;
51
+ /** How often an active run is polled. */
52
+ export declare const RUN_POLL_INTERVAL_MS = 1500;
53
+ /**
54
+ * How long after a run was created it is still polled automatically. A run
55
+ * that is still not terminal by then (for example because the worker died
56
+ * without marking it FAILED) is left for the user to re-check by hand.
57
+ */
58
+ export declare const RUN_POLL_MAX_MS: number;
59
+ export declare function isTerminalRunStatus(status: SemQueryRunStatus): boolean;
60
+ /** True once a non-terminal run has been active longer than {@link RUN_POLL_MAX_MS}. */
61
+ export declare function isRunPollExpired(run: Pick<SemQueryRun, 'status' | 'createdAt'>, now?: number): boolean;
62
+ export declare function useSemSavedQueries(modelId: string | null): import('@tanstack/react-query').UseQueryResult<SemSavedQuery[], Error>;
63
+ export declare function useSemRunSavedQuery(): import('@tanstack/react-query').UseMutationResult<SemQueryRun, Error, string, unknown>;
64
+ /**
65
+ * One run, polled every {@link RUN_POLL_INTERVAL_MS} until it is terminal (or
66
+ * for at most {@link RUN_POLL_MAX_MS}). Each poll clears the shell's
67
+ * short-lived (15 s) read cache, which would otherwise replay the QUEUED
68
+ * response for its whole TTL. That cache is keyed by operation and variables
69
+ * with no per-entry eviction, so it is cleared as a whole; other reads on the
70
+ * page are held by React Query, so clearing it does not trigger refetches.
71
+ */
72
+ export declare function useSemQueryRun(runId: string | null): import('@tanstack/react-query').UseQueryResult<SemQueryRun | null, Error>;
73
+ export declare function useSemQueryRuns(queryId: string | null): import('@tanstack/react-query').UseQueryResult<SemQueryRun[], Error>;
74
+ /** One page of a SUCCEEDED run's governed rows; `runId` null keeps it idle. */
75
+ export declare function useSemQueryRunResult(runId: string | null, offset: number): import('@tanstack/react-query').UseQueryResult<SemQueryRunResultPage, Error>;
76
+ /** One access-policy decision recorded on `planSummary.governance`. */
77
+ export interface SemGovernanceDecision {
78
+ action: string;
79
+ entity: string;
80
+ field: string | null;
81
+ policyName: string | null;
82
+ mask: string | null;
83
+ detail: string | null;
84
+ }
85
+ export interface SemRunGovernance {
86
+ outcome: 'ALLOWED' | 'DENIED';
87
+ policiesEvaluated: number;
88
+ reason: string | null;
89
+ decisions: SemGovernanceDecision[];
90
+ }
91
+ /**
92
+ * The access-policy record of a run (`planSummary.governance`), or null when
93
+ * the run was not governed. `planSummary` is untyped JSON, so every field is
94
+ * checked before use.
95
+ */
96
+ export declare function runGovernance(planSummary: unknown): SemRunGovernance | null;
97
+ export declare function restrictiveDecisions(governance: SemRunGovernance): SemGovernanceDecision[];
@@ -1,54 +1,54 @@
1
- import { useSemanticFed as e } from "../providers/SemanticFedProvider.js";
2
- import { clearGraphqlReadCaches as t, semRequest as n } from "../api/semanticfedGraphql.js";
1
+ import { clearGraphqlReadCaches as e, semRequest as t } from "../api/semanticfedGraphql.js";
2
+ import { useSemanticFed as n } from "../providers/SemanticFedProvider.js";
3
3
  import { useMutation as r, useQuery as i, useQueryClient as a } from "@tanstack/react-query";
4
- var o = 100, s = 20, c = 1500, l = new Set([
4
+ var o = 100, s = 20, c = 1500, l = 6e5, u = /* @__PURE__ */ new Set([
5
5
  "SUCCEEDED",
6
6
  "FAILED",
7
7
  "CANCELLED"
8
8
  ]);
9
- function u(e) {
10
- return l.has(e);
9
+ function d(e) {
10
+ return u.has(e);
11
11
  }
12
- function d(e, t = Date.now()) {
13
- if (u(e.status)) return !1;
12
+ function f(e, t = Date.now()) {
13
+ if (d(e.status)) return !1;
14
14
  let n = Date.parse(e.createdAt);
15
15
  return Number.isFinite(n) && t - n > 6e5;
16
16
  }
17
- var f = "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", p = "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}", m = `mutation SemConsoleRunQuery($id: ID!) {
17
+ var p = "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", m = "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}", h = `mutation SemConsoleRunQuery($id: ID!) {
18
18
  semRunQuery(id: $id) {
19
- ${f}
19
+ ${p}
20
20
  }
21
- }`, h = `query SemConsoleQueryRun($id: ID!) {
21
+ }`, g = `query SemConsoleQueryRun($id: ID!) {
22
22
  semQueryRun(id: $id) {
23
- ${f}
23
+ ${p}
24
24
  }
25
- }`, g = `query SemConsoleQueryRuns($queryId: ID!, $pagination: PaginationInput) {
25
+ }`, _ = `query SemConsoleQueryRuns($queryId: ID!, $pagination: PaginationInput) {
26
26
  semListQueryRuns(queryId: $queryId, pagination: $pagination) {
27
27
  items {
28
- ${f}
28
+ ${p}
29
29
  }
30
30
  }
31
- }`, _ = "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}";
32
- function v(t) {
33
- let { apiGatewayUrl: r, workspaceId: a } = e();
31
+ }`, v = "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}";
32
+ function y(e) {
33
+ let { apiGatewayUrl: r, workspaceId: a } = n();
34
34
  return i({
35
35
  queryKey: [
36
36
  "semanticfed",
37
37
  "savedQueries",
38
38
  a ?? "no-workspace",
39
- t
39
+ e
40
40
  ],
41
41
  enabled: !!a,
42
- queryFn: async () => (await n(p, {
43
- modelId: t,
42
+ queryFn: async () => (await t(m, {
43
+ modelId: e,
44
44
  pagination: { limit: o }
45
45
  }, r)).semListQueries.items.filter((e) => e.status !== "ARCHIVED")
46
46
  });
47
47
  }
48
- function y() {
49
- let { apiGatewayUrl: t, workspaceId: i } = e(), o = a();
48
+ function b() {
49
+ let { apiGatewayUrl: e, workspaceId: i } = n(), o = a();
50
50
  return r({
51
- mutationFn: async (e) => (await n(m, { id: e }, t)).semRunQuery,
51
+ mutationFn: async (n) => (await t(h, { id: n }, e)).semRunQuery,
52
52
  onSuccess: (e) => {
53
53
  o.setQueryData([
54
54
  "semanticfed",
@@ -64,8 +64,8 @@ function y() {
64
64
  }
65
65
  });
66
66
  }
67
- function b(r) {
68
- let { apiGatewayUrl: o, workspaceId: s } = e(), l = a();
67
+ function x(r) {
68
+ let { apiGatewayUrl: o, workspaceId: s } = n(), l = a();
69
69
  return i({
70
70
  queryKey: [
71
71
  "semanticfed",
@@ -76,23 +76,23 @@ function b(r) {
76
76
  enabled: !!(s && r),
77
77
  staleTime: 0,
78
78
  queryFn: async () => {
79
- t();
80
- let e = (await n(h, { id: r }, o)).semQueryRun;
81
- return e && u(e.status) && l.invalidateQueries({ queryKey: [
79
+ e();
80
+ let n = (await t(g, { id: r }, o)).semQueryRun;
81
+ return n && d(n.status) && l.invalidateQueries({ queryKey: [
82
82
  "semanticfed",
83
83
  "queryRuns",
84
84
  s ?? "no-workspace",
85
- e.queryId
86
- ] }), e;
85
+ n.queryId
86
+ ] }), n;
87
87
  },
88
88
  refetchInterval: (e) => {
89
89
  let t = e.state.data;
90
- return t === null || t && (u(t.status) || d(t)) ? !1 : c;
90
+ return t === null || t && (d(t.status) || f(t)) ? !1 : c;
91
91
  }
92
92
  });
93
93
  }
94
- function x(r) {
95
- let { apiGatewayUrl: a, workspaceId: o } = e();
94
+ function S(r) {
95
+ let { apiGatewayUrl: a, workspaceId: o } = n();
96
96
  return i({
97
97
  queryKey: [
98
98
  "semanticfed",
@@ -102,26 +102,26 @@ function x(r) {
102
102
  ],
103
103
  enabled: !!(o && r),
104
104
  staleTime: 0,
105
- queryFn: async () => (t(), (await n(g, {
105
+ queryFn: async () => (e(), (await t(_, {
106
106
  queryId: r,
107
107
  pagination: { limit: s }
108
108
  }, a)).semListQueryRuns.items)
109
109
  });
110
110
  }
111
- function S(t, r) {
112
- let { apiGatewayUrl: a, workspaceId: o } = e();
111
+ function C(e, r) {
112
+ let { apiGatewayUrl: a, workspaceId: o } = n();
113
113
  return i({
114
114
  queryKey: [
115
115
  "semanticfed",
116
116
  "queryRunResult",
117
117
  o ?? "no-workspace",
118
- t,
118
+ e,
119
119
  r
120
120
  ],
121
- enabled: !!(o && t),
121
+ enabled: !!(o && e),
122
122
  retry: !1,
123
- queryFn: async () => (await n(_, {
124
- runId: t,
123
+ queryFn: async () => (await t(v, {
124
+ runId: e,
125
125
  pagination: {
126
126
  limit: 100,
127
127
  offset: r
@@ -129,43 +129,42 @@ function S(t, r) {
129
129
  }, a)).semQueryRunResult
130
130
  });
131
131
  }
132
- function C(e) {
132
+ function w(e) {
133
133
  return typeof e == "object" && e && !Array.isArray(e) ? e : null;
134
134
  }
135
- function w(e) {
135
+ function T(e) {
136
136
  return typeof e == "string" && e !== "" ? e : null;
137
137
  }
138
- function T(e) {
139
- let t = C(C(e)?.governance);
138
+ function E(e) {
139
+ let t = w(w(e)?.governance);
140
140
  if (!t) return null;
141
141
  let n = t.outcome === "ALLOWED" ? "ALLOWED" : "DENIED", r = Array.isArray(t.decisions) ? t.decisions : [];
142
142
  return {
143
143
  outcome: n,
144
144
  policiesEvaluated: typeof t.policiesEvaluated == "number" ? t.policiesEvaluated : 0,
145
- reason: w(t.reason),
145
+ reason: T(t.reason),
146
146
  decisions: r.flatMap((e) => {
147
- let t = C(e);
147
+ let t = w(e);
148
148
  return !t || typeof t.action != "string" ? [] : [{
149
149
  action: t.action,
150
- entity: w(t.entity) ?? "",
151
- field: w(t.field),
152
- policyName: w(t.policyName),
153
- mask: w(t.mask),
154
- detail: w(t.detail)
150
+ entity: T(t.entity) ?? "",
151
+ field: T(t.field),
152
+ policyName: T(t.policyName),
153
+ mask: T(t.mask),
154
+ detail: T(t.detail)
155
155
  }];
156
156
  })
157
157
  };
158
158
  }
159
- var E = new Set([
159
+ var D = /* @__PURE__ */ new Set([
160
160
  "ENTITY_DENIED",
161
161
  "ROWS_BLOCKED",
162
162
  "COLUMN_DENIED",
163
163
  "EVALUATION_FAILED"
164
164
  ]);
165
- function D(e) {
166
- return e.decisions.filter((e) => E.has(e.action));
165
+ function O(e) {
166
+ return e.decisions.filter((e) => D.has(e.action));
167
167
  }
168
- //#endregion
169
- export { d as isRunPollExpired, u as isTerminalRunStatus, D as restrictiveDecisions, T as runGovernance, b as useSemQueryRun, S as useSemQueryRunResult, x as useSemQueryRuns, y as useSemRunSavedQuery, v as useSemSavedQueries };
168
+ export { c as RUN_POLL_INTERVAL_MS, l as RUN_POLL_MAX_MS, f as isRunPollExpired, d as isTerminalRunStatus, O as restrictiveDecisions, E as runGovernance, x as useSemQueryRun, C as useSemQueryRunResult, S as useSemQueryRuns, b as useSemRunSavedQuery, y as useSemSavedQueries };
170
169
 
171
170
  //# sourceMappingURL=useQueryRuns.js.map
@@ -1 +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":";;;AAiFA,IAAM,IAA2B,KAE3B,IAAoB,IAEb,IAAuB,MAQ9B,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EAAc,GAA+C;CAC3E,IAAM,IAAa,EAAS,EAAS,EAAY,EAAE,WAAW;AAC9D,KAAI,CAAC,EAAY,QAAO;CAGxB,IAAM,IAAU,EAAW,YAAY,YAAY,YAAY,UACzD,IAAY,MAAM,QAAQ,EAAW,UAAU,GAAG,EAAW,YAAY,EAAE;AACjF,QAAO;EACL;EACA,mBACE,OAAO,EAAW,qBAAsB,WAAW,EAAW,oBAAoB;EACpF,QAAQ,EAAe,EAAW,OAAO;EACzC,WAAW,EAAU,SAAS,MAAQ;GACpC,IAAM,IAAI,EAAS,EAAI;AAEvB,UADI,CAAC,KAAK,OAAO,EAAE,UAAW,WAAiB,EAAE,GAC1C,CACL;IACE,QAAQ,EAAE;IACV,QAAQ,EAAe,EAAE,OAAO,IAAI;IACpC,OAAO,EAAe,EAAE,MAAM;IAC9B,YAAY,EAAe,EAAE,WAAW;IACxC,MAAM,EAAe,EAAE,KAAK;IAC5B,QAAQ,EAAe,EAAE,OAAO;IACjC,CACF;IACD;EACH;;AAIH,IAAM,IAA2C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACD,CAAC;AAEF,SAAgB,EAAqB,GAAuD;AAC1F,QAAO,EAAW,UAAU,QAAQ,MAAM,EAAoB,IAAI,EAAE,OAAO,CAAC"}
1
+ {"version":3,"file":"useQueryRuns.js","names":["SAVED_QUERY_PICKER_LIMIT","RUN_HISTORY_LIMIT","RUN_POLL_INTERVAL_MS","RUN_POLL_MAX_MS","TERMINAL_STATUSES","isTerminalRunStatus","status","isRunPollExpired","run","created","now","RUN_FIELDS","LIST_QUERIES_QUERY","RUN_QUERY_MUTATION","QUERY_RUN_QUERY","QUERY_RUNS_QUERY","QUERY_RUN_RESULT_QUERY","useSemSavedQueries","useSemanticFed","useQuery","workspaceId","modelId","semRequest","apiGatewayUrl","q","useSemRunSavedQuery","queryClient","useQueryClient","useMutation","queryId","useSemQueryRun","runId","query","useSemQueryRuns","clearGraphqlReadCaches","useSemQueryRunResult","offset","asRecord","value","optionalString","runGovernance","governance","planSummary","outcome","decisions","d","raw","RESTRICTIVE_ACTIONS","restrictiveDecisions"],"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' | 'PLANNING' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | '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":";;;AA4EA,IAAMA,IAA2B,KAE3BC,IAAoB,IAEbC,IAAuB,MAMvBC,IAAkB,KAEzBC,oBAAoD,IAAI,IAAI;CAChE;CACA;CACA;AACF,CAAC;AAED,SAAgBC,EAAoB,GAAoC;CACtE,OAAOD,EAAkB,IAAIE,CAAM;AACrC;AAGA,SAAgBC,EACd,GACA,IAAc,KAAK,IAAI,GACd;CACT,IAAIF,EAAoBG,EAAI,MAAM,GAAG,OAAO;CAC5C,IAAMC,IAAU,KAAK,MAAMD,EAAI,SAAS;CACxC,OAAO,OAAO,SAASC,CAAO,KAAKC,IAAMD,IAAA;AAC3C;AAEA,IAAME,IAAa,8LAcbC,IAAqB,8RAerBC,IAAqB;;MAErBF,EAAW;;IAIXG,IAAkB;;MAElBH,EAAW;;IAIXI,IAAmB;;;QAGjBJ,EAAW;;;IAKbK,IAAyB;AAuB/B,SAAgBC,EAAmB,GAAwB;CACzD,IAAM,EAAE,kBAAe,mBAAgBC,EAAe;CACtD,OAAOC,EAAS;EACd,UAAU;GAAC;GAAe;GAAgBC,KAAe;GAAgBC;EAAO;EAChF,SAAS,EAAQD;EACjB,SAAS,aAOA,MANYE,EACjBV,GACA;GAAE;GAAS,YAAY,EAAE,OAAOZ,EAAyB;EAAE,GAC3DuB,CACF,EAAA,CAEY,eAAe,MAAM,QAAQ,MAAMC,EAAE,WAAW,UAAU;CAE1E,CAAC;AACH;AAEA,SAAgBC,IAAsB;CACpC,IAAM,EAAE,kBAAe,mBAAgBP,EAAe,GAChDQ,IAAcC,EAAe;CACnC,OAAOC,EAAY;EACjB,YAAY,OAAO,OAMV,MALYN,EACjBT,GACA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C;AAED,SAAgBC,EAAqB,GAAuD;CAC1F,OAAOP,EAAW,UAAU,QAAQ,MAAMM,EAAoB,IAAIF,EAAE,MAAM,CAAC;AAC7E"}
@@ -0,0 +1,58 @@
1
+ export type SemSqlDataType = 'STRING' | 'INTEGER' | 'DECIMAL' | 'BOOLEAN' | 'DATE' | 'TIMESTAMP' | 'JSON' | 'GEO' | 'UNKNOWN';
2
+ export interface SemModelSummary {
3
+ id: string;
4
+ name: string;
5
+ status: string;
6
+ }
7
+ export interface SemSqlCatalogColumn {
8
+ name: string;
9
+ kind: 'DIMENSION' | 'METRIC';
10
+ dataType: SemSqlDataType;
11
+ aggregation: string | null;
12
+ description: string | null;
13
+ isPrimary: boolean;
14
+ }
15
+ export interface SemSqlCatalogTable {
16
+ name: string;
17
+ kind: string;
18
+ description: string | null;
19
+ primaryKey: string | null;
20
+ columns: SemSqlCatalogColumn[];
21
+ }
22
+ export interface SemSqlCatalog {
23
+ modelId: string;
24
+ modelName: string;
25
+ tables: SemSqlCatalogTable[];
26
+ }
27
+ export interface SemSqlResultColumn {
28
+ name: string;
29
+ entity: string;
30
+ field: string;
31
+ aggregation: string | null;
32
+ dataType: SemSqlDataType;
33
+ masked: boolean;
34
+ mask: string | null;
35
+ }
36
+ export interface SemSqlResult {
37
+ modelId: string;
38
+ columns: SemSqlResultColumn[];
39
+ rows: Array<Record<string, unknown>>;
40
+ rowCount: number;
41
+ truncated: boolean;
42
+ durationMs: number;
43
+ sourcesTouched: number;
44
+ }
45
+ export interface SemExecuteSqlInput {
46
+ sql: string;
47
+ modelId: string;
48
+ maxRows?: number;
49
+ }
50
+ export declare function useSemSqlModels(): import('@tanstack/react-query').UseQueryResult<SemModelSummary[], Error>;
51
+ export declare function useSemSqlCatalog(modelId: string | null): import('@tanstack/react-query').UseQueryResult<SemSqlCatalog, Error>;
52
+ export declare function useSemExecuteSql(): import('@tanstack/react-query').UseMutationResult<SemSqlResult, Error, SemExecuteSqlInput, unknown>;
53
+ /**
54
+ * The text to show for a failed SQL statement. The gateway generalises client
55
+ * errors, so the service's own explanation (syntax position, unknown column,
56
+ * policy denial) is preferred whenever the service sent one.
57
+ */
58
+ export declare function sqlErrorMessage(error: unknown): string;
@@ -1,10 +1,10 @@
1
- import { useSemanticFed as e } from "../providers/SemanticFedProvider.js";
2
- import { SemRequestError as t, semRequest as n } from "../api/semanticfedGraphql.js";
1
+ import { SemRequestError as e, semRequest as t } from "../api/semanticfedGraphql.js";
2
+ import { useSemanticFed as n } from "../providers/SemanticFedProvider.js";
3
3
  import { useMutation as r, useQuery as i } from "@tanstack/react-query";
4
- //#region src/semanticfed/hooks/useSqlConsole.ts
4
+ // src/semanticfed/hooks/useSqlConsole.ts
5
5
  var a = "query SemSqlConsoleModels($pagination: PaginationInput) {\n semListModels(pagination: $pagination) {\n items {\n id\n name\n status\n }\n }\n}", o = "query SemSqlCatalog($modelId: ID) {\n semSqlCatalog(modelId: $modelId) {\n modelId\n modelName\n tables {\n name\n kind\n description\n primaryKey\n columns {\n name\n kind\n dataType\n aggregation\n description\n isPrimary\n }\n }\n }\n}", s = "mutation SemExecuteSql($input: SemExecuteSqlInput!) {\n semExecuteSql(input: $input) {\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}", c = 100;
6
6
  function l() {
7
- let { apiGatewayUrl: t, workspaceId: r } = e();
7
+ let { apiGatewayUrl: e, workspaceId: r } = n();
8
8
  return i({
9
9
  queryKey: [
10
10
  "semanticfed",
@@ -13,31 +13,30 @@ function l() {
13
13
  r ?? "no-workspace"
14
14
  ],
15
15
  enabled: !!r,
16
- queryFn: async () => (await n(a, { pagination: { limit: c } }, t)).semListModels.items
16
+ queryFn: async () => (await t(a, { pagination: { limit: c } }, e)).semListModels.items
17
17
  });
18
18
  }
19
- function u(t) {
20
- let { apiGatewayUrl: r, workspaceId: a } = e();
19
+ function u(e) {
20
+ let { apiGatewayUrl: r, workspaceId: a } = n();
21
21
  return i({
22
22
  queryKey: [
23
23
  "semanticfed",
24
24
  "sql",
25
25
  "catalog",
26
26
  a ?? "no-workspace",
27
- t
27
+ e
28
28
  ],
29
- enabled: !!(a && t),
30
- queryFn: async () => (await n(o, { modelId: t }, r)).semSqlCatalog
29
+ enabled: !!(a && e),
30
+ queryFn: async () => (await t(o, { modelId: e }, r)).semSqlCatalog
31
31
  });
32
32
  }
33
33
  function d() {
34
- let { apiGatewayUrl: t } = e();
35
- return r({ mutationFn: async (e) => (await n(s, { input: e }, t)).semExecuteSql });
34
+ let { apiGatewayUrl: e } = n();
35
+ return r({ mutationFn: async (n) => (await t(s, { input: n }, e)).semExecuteSql });
36
36
  }
37
- function f(e) {
38
- return e instanceof t && e.detail && e.code !== "INTERNAL_SERVER_ERROR" ? e.detail : e instanceof Error ? e.message : String(e);
37
+ function f(t) {
38
+ return t instanceof e && t.detail && t.code !== "INTERNAL_SERVER_ERROR" ? t.detail : t instanceof Error ? t.message : String(t);
39
39
  }
40
- //#endregion
41
40
  export { f as sqlErrorMessage, d as useSemExecuteSql, u as useSemSqlCatalog, l as useSemSqlModels };
42
41
 
43
42
  //# sourceMappingURL=useSqlConsole.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSqlConsole.js","names":[],"sources":["../../../src/semanticfed/hooks/useSqlConsole.ts"],"sourcesContent":["/**\n * SQL console hooks, wired to the real `wspace-semanticfed-svc` SQL endpoint\n * (BOFF-4271): `semListModels` to pick a semantic model, `semSqlCatalog` for\n * the table/column browser and `semExecuteSql` to run a read-only SELECT\n * through the federated query engine with the caller's access policies.\n */\nimport { useMutation, useQuery } from '@tanstack/react-query';\n\nimport { SemRequestError, semRequest } from '../api/semanticfedGraphql';\nimport { useSemanticFed } from '../providers/SemanticFedProvider';\n\nexport type SemSqlDataType =\n | 'STRING'\n | 'INTEGER'\n | 'DECIMAL'\n | 'BOOLEAN'\n | 'DATE'\n | 'TIMESTAMP'\n | 'JSON'\n | 'GEO'\n | 'UNKNOWN';\n\nexport interface SemModelSummary {\n id: string;\n name: string;\n status: string;\n}\n\nexport interface SemSqlCatalogColumn {\n name: string;\n kind: 'DIMENSION' | 'METRIC';\n dataType: SemSqlDataType;\n aggregation: string | null;\n description: string | null;\n isPrimary: boolean;\n}\n\nexport interface SemSqlCatalogTable {\n name: string;\n kind: string;\n description: string | null;\n primaryKey: string | null;\n columns: SemSqlCatalogColumn[];\n}\n\nexport interface SemSqlCatalog {\n modelId: string;\n modelName: string;\n tables: SemSqlCatalogTable[];\n}\n\nexport interface SemSqlResultColumn {\n name: string;\n entity: string;\n field: string;\n aggregation: string | null;\n dataType: SemSqlDataType;\n masked: boolean;\n mask: string | null;\n}\n\nexport interface SemSqlResult {\n modelId: string;\n columns: SemSqlResultColumn[];\n rows: Array<Record<string, unknown>>;\n rowCount: number;\n truncated: boolean;\n durationMs: number;\n sourcesTouched: number;\n}\n\nexport interface SemExecuteSqlInput {\n sql: string;\n modelId: string;\n maxRows?: number;\n}\n\nconst LIST_MODELS_QUERY = `query SemSqlConsoleModels($pagination: PaginationInput) {\n semListModels(pagination: $pagination) {\n items {\n id\n name\n status\n }\n }\n}`;\n\nconst SQL_CATALOG_QUERY = `query SemSqlCatalog($modelId: ID) {\n semSqlCatalog(modelId: $modelId) {\n modelId\n modelName\n tables {\n name\n kind\n description\n primaryKey\n columns {\n name\n kind\n dataType\n aggregation\n description\n isPrimary\n }\n }\n }\n}`;\n\nconst EXECUTE_SQL_MUTATION = `mutation SemExecuteSql($input: SemExecuteSqlInput!) {\n semExecuteSql(input: $input) {\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/** Largest model list the console offers (the picker is not paginated). */\nconst MODEL_PICKER_LIMIT = 100;\n\nexport function useSemSqlModels() {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'sql', 'models', workspaceId ?? 'no-workspace'] as const,\n enabled: Boolean(workspaceId),\n queryFn: async () => {\n const data = await semRequest<{ semListModels: { items: SemModelSummary[] } }>(\n LIST_MODELS_QUERY,\n { pagination: { limit: MODEL_PICKER_LIMIT } },\n apiGatewayUrl\n );\n return data.semListModels.items;\n },\n });\n}\n\nexport function useSemSqlCatalog(modelId: string | null) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'sql', 'catalog', workspaceId ?? 'no-workspace', modelId] as const,\n enabled: Boolean(workspaceId && modelId),\n queryFn: async () => {\n const data = await semRequest<{ semSqlCatalog: SemSqlCatalog }>(\n SQL_CATALOG_QUERY,\n { modelId },\n apiGatewayUrl\n );\n return data.semSqlCatalog;\n },\n });\n}\n\nexport function useSemExecuteSql() {\n const { apiGatewayUrl } = useSemanticFed();\n return useMutation({\n mutationFn: async (input: SemExecuteSqlInput) => {\n const data = await semRequest<{ semExecuteSql: SemSqlResult }>(\n EXECUTE_SQL_MUTATION,\n { input },\n apiGatewayUrl\n );\n return data.semExecuteSql;\n },\n });\n}\n\n/**\n * The text to show for a failed SQL statement. The gateway generalises client\n * errors, so the service's own explanation (syntax position, unknown column,\n * policy denial) is preferred whenever the service sent one.\n */\nexport function sqlErrorMessage(error: unknown): string {\n if (error instanceof SemRequestError && error.detail && error.code !== 'INTERNAL_SERVER_ERROR') {\n return error.detail;\n }\n return error instanceof Error ? error.message : String(error);\n}\n"],"mappings":";;;;AA6EA,IAAM,IAAoB,yKAUpB,IAAoB,wUAqBpB,IAAuB,qTAqBvB,IAAqB;AAE3B,SAAgB,IAAkB;CAChC,IAAM,EAAE,kBAAe,mBAAgB,GAAgB;AACvD,QAAO,EAAS;EACd,UAAU;GAAC;GAAe;GAAO;GAAU,KAAe;GAAe;EACzE,SAAS,EAAQ;EACjB,SAAS,aACM,MAAM,EACjB,GACA,EAAE,YAAY,EAAE,OAAO,GAAoB,EAAE,EAC7C,EACD,EACW,cAAc;EAE7B,CAAC;;AAGJ,SAAgB,EAAiB,GAAwB;CACvD,IAAM,EAAE,kBAAe,mBAAgB,GAAgB;AACvD,QAAO,EAAS;EACd,UAAU;GAAC;GAAe;GAAO;GAAW,KAAe;GAAgB;GAAQ;EACnF,SAAS,GAAQ,KAAe;EAChC,SAAS,aACM,MAAM,EACjB,GACA,EAAE,YAAS,EACX,EACD,EACW;EAEf,CAAC;;AAGJ,SAAgB,IAAmB;CACjC,IAAM,EAAE,qBAAkB,GAAgB;AAC1C,QAAO,EAAY,EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,GACA,EAAE,UAAO,EACT,EACD,EACW,eAEf,CAAC;;AAQJ,SAAgB,EAAgB,GAAwB;AAItD,QAHI,aAAiB,KAAmB,EAAM,UAAU,EAAM,SAAS,0BAC9D,EAAM,SAER,aAAiB,QAAQ,EAAM,UAAU,OAAO,EAAM"}
1
+ {"version":3,"file":"useSqlConsole.js","names":["LIST_MODELS_QUERY","SQL_CATALOG_QUERY","EXECUTE_SQL_MUTATION","MODEL_PICKER_LIMIT","useSemSqlModels","useSemanticFed","useQuery","workspaceId","semRequest","apiGatewayUrl","useSemSqlCatalog","modelId","useSemExecuteSql","useMutation","sqlErrorMessage","error","SemRequestError"],"sources":["../../../src/semanticfed/hooks/useSqlConsole.ts"],"sourcesContent":["/**\n * SQL console hooks, wired to the real `wspace-semanticfed-svc` SQL endpoint\n * (BOFF-4271): `semListModels` to pick a semantic model, `semSqlCatalog` for\n * the table/column browser and `semExecuteSql` to run a read-only SELECT\n * through the federated query engine with the caller's access policies.\n */\nimport { useMutation, useQuery } from '@tanstack/react-query';\n\nimport { SemRequestError, semRequest } from '../api/semanticfedGraphql';\nimport { useSemanticFed } from '../providers/SemanticFedProvider';\n\nexport type SemSqlDataType =\n 'STRING' | 'INTEGER' | 'DECIMAL' | 'BOOLEAN' | 'DATE' | 'TIMESTAMP' | 'JSON' | 'GEO' | 'UNKNOWN';\n\nexport interface SemModelSummary {\n id: string;\n name: string;\n status: string;\n}\n\nexport interface SemSqlCatalogColumn {\n name: string;\n kind: 'DIMENSION' | 'METRIC';\n dataType: SemSqlDataType;\n aggregation: string | null;\n description: string | null;\n isPrimary: boolean;\n}\n\nexport interface SemSqlCatalogTable {\n name: string;\n kind: string;\n description: string | null;\n primaryKey: string | null;\n columns: SemSqlCatalogColumn[];\n}\n\nexport interface SemSqlCatalog {\n modelId: string;\n modelName: string;\n tables: SemSqlCatalogTable[];\n}\n\nexport interface SemSqlResultColumn {\n name: string;\n entity: string;\n field: string;\n aggregation: string | null;\n dataType: SemSqlDataType;\n masked: boolean;\n mask: string | null;\n}\n\nexport interface SemSqlResult {\n modelId: string;\n columns: SemSqlResultColumn[];\n rows: Array<Record<string, unknown>>;\n rowCount: number;\n truncated: boolean;\n durationMs: number;\n sourcesTouched: number;\n}\n\nexport interface SemExecuteSqlInput {\n sql: string;\n modelId: string;\n maxRows?: number;\n}\n\nconst LIST_MODELS_QUERY = `query SemSqlConsoleModels($pagination: PaginationInput) {\n semListModels(pagination: $pagination) {\n items {\n id\n name\n status\n }\n }\n}`;\n\nconst SQL_CATALOG_QUERY = `query SemSqlCatalog($modelId: ID) {\n semSqlCatalog(modelId: $modelId) {\n modelId\n modelName\n tables {\n name\n kind\n description\n primaryKey\n columns {\n name\n kind\n dataType\n aggregation\n description\n isPrimary\n }\n }\n }\n}`;\n\nconst EXECUTE_SQL_MUTATION = `mutation SemExecuteSql($input: SemExecuteSqlInput!) {\n semExecuteSql(input: $input) {\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/** Largest model list the console offers (the picker is not paginated). */\nconst MODEL_PICKER_LIMIT = 100;\n\nexport function useSemSqlModels() {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'sql', 'models', workspaceId ?? 'no-workspace'] as const,\n enabled: Boolean(workspaceId),\n queryFn: async () => {\n const data = await semRequest<{ semListModels: { items: SemModelSummary[] } }>(\n LIST_MODELS_QUERY,\n { pagination: { limit: MODEL_PICKER_LIMIT } },\n apiGatewayUrl\n );\n return data.semListModels.items;\n },\n });\n}\n\nexport function useSemSqlCatalog(modelId: string | null) {\n const { apiGatewayUrl, workspaceId } = useSemanticFed();\n return useQuery({\n queryKey: ['semanticfed', 'sql', 'catalog', workspaceId ?? 'no-workspace', modelId] as const,\n enabled: Boolean(workspaceId && modelId),\n queryFn: async () => {\n const data = await semRequest<{ semSqlCatalog: SemSqlCatalog }>(\n SQL_CATALOG_QUERY,\n { modelId },\n apiGatewayUrl\n );\n return data.semSqlCatalog;\n },\n });\n}\n\nexport function useSemExecuteSql() {\n const { apiGatewayUrl } = useSemanticFed();\n return useMutation({\n mutationFn: async (input: SemExecuteSqlInput) => {\n const data = await semRequest<{ semExecuteSql: SemSqlResult }>(\n EXECUTE_SQL_MUTATION,\n { input },\n apiGatewayUrl\n );\n return data.semExecuteSql;\n },\n });\n}\n\n/**\n * The text to show for a failed SQL statement. The gateway generalises client\n * errors, so the service's own explanation (syntax position, unknown column,\n * policy denial) is preferred whenever the service sent one.\n */\nexport function sqlErrorMessage(error: unknown): string {\n if (error instanceof SemRequestError && error.detail && error.code !== 'INTERNAL_SERVER_ERROR') {\n return error.detail;\n }\n return error instanceof Error ? error.message : String(error);\n}\n"],"mappings":";;;;AAqEA,IAAMA,IAAoB,yKAUpBC,IAAoB,wUAqBpBC,IAAuB,qTAqBvBC,IAAqB;AAE3B,SAAgBC,IAAkB;CAChC,IAAM,EAAE,kBAAe,mBAAgBC,EAAe;CACtD,OAAOC,EAAS;EACd,UAAU;GAAC;GAAe;GAAO;GAAUC,KAAe;EAAc;EACxE,SAAS,EAAQA;EACjB,SAAS,aAMA,MALYC,EACjBR,GACA,EAAE,YAAY,EAAE,OAAOG,EAAmB,EAAE,GAC5CM,CACF,EAAA,CACY,cAAc;CAE9B,CAAC;AACH;AAEA,SAAgBC,EAAiB,GAAwB;CACvD,IAAM,EAAE,kBAAe,mBAAgBL,EAAe;CACtD,OAAOC,EAAS;EACd,UAAU;GAAC;GAAe;GAAO;GAAWC,KAAe;GAAgBI;EAAO;EAClF,SAAS,GAAQJ,KAAeI;EAChC,SAAS,aAMA,MALYH,EACjBP,GACA,EAAE,WAAQ,GACVQ,CACF,EAAA,CACY;CAEhB,CAAC;AACH;AAEA,SAAgBG,IAAmB;CACjC,IAAM,EAAE,qBAAkBP,EAAe;CACzC,OAAOQ,EAAY,EACjB,YAAY,OAAO,OAMV,MALYL,EACjBN,GACA,EAAE,SAAM,GACRO,CACF,EAAA,CACY,cAEhB,CAAC;AACH;AAOA,SAAgBK,EAAgB,GAAwB;CAItD,OAHIC,aAAiBC,KAAmBD,EAAM,UAAUA,EAAM,SAAS,0BAC9DA,EAAM,SAERA,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK;AAC9D"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * useTr — translation hook with fallback semantics.
3
+ *
4
+ * Wraps `useI18n().t()` so that when a key has no translation (i.e. the
5
+ * provider returns the key itself), the caller's English fallback is used
6
+ * instead. This keeps consumer call sites consistent and avoids leaking
7
+ * untranslated keys into the UI.
8
+ *
9
+ * Supports optional interpolation params using `{{key}}` placeholders.
10
+ *
11
+ * @example
12
+ * const tr = useTr();
13
+ * return <h1>{tr('semanticfed.dashboard.title', 'SemanticFed Dashboard')}</h1>;
14
+ * return <p>{tr('semanticfed.delete.confirm', 'Delete {{count}} items?', { count: 5 })}</p>;
15
+ */
16
+ export declare function useTr(): (key: string, fallback: string, params?: Record<string, string | number>) => string;
@@ -1,12 +1,11 @@
1
1
  import { translateWithFallback as e } from "../utils/i18n.js";
2
2
  import { useCallback as t } from "react";
3
3
  import { useI18n as n } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
4
- //#region src/semanticfed/hooks/useTr.ts
4
+ // src/semanticfed/hooks/useTr.ts
5
5
  function r() {
6
6
  let { t: r } = n();
7
7
  return t((t, n, i) => e(r, t, n, i), [r]);
8
8
  }
9
- //#endregion
10
9
  export { r as useTr };
11
10
 
12
11
  //# sourceMappingURL=useTr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTr.js","names":[],"sources":["../../../src/semanticfed/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('semanticfed.dashboard.title', 'SemanticFed Dashboard')}</h1>;\n * return <p>{tr('semanticfed.delete.confirm', 'Delete {{count}} items?', { count: 5 })}</p>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: Record<string, string | number>): string =>\n translateWithFallback(t, key, fallback, params),\n [t]\n );\n}\n"],"mappings":";;;;AAmBA,SAAgB,IAIJ;CACV,IAAM,EAAE,SAAM,GAAS;AACvB,QAAO,GACJ,GAAa,GAAkB,MAC9B,EAAsB,GAAG,GAAK,GAAU,EAAO,EACjD,CAAC,EAAE,CACJ"}
1
+ {"version":3,"file":"useTr.js","names":["useTr","useI18n","useCallback","translateWithFallback","t","key","fallback","params"],"sources":["../../../src/semanticfed/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('semanticfed.dashboard.title', 'SemanticFed Dashboard')}</h1>;\n * return <p>{tr('semanticfed.delete.confirm', 'Delete {{count}} items?', { count: 5 })}</p>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: Record<string, string | number>): string =>\n translateWithFallback(t, key, fallback, params),\n [t]\n );\n}\n"],"mappings":";;;;AAmBA,SAAgBA,IAIJ;CACV,IAAM,EAAE,SAAMC,EAAQ;CACtB,OAAOC,GACJ,GAAa,GAAkB,MAC9BC,EAAsBC,GAAGC,GAAKC,GAAUC,CAAM,GAChD,CAACH,CAAC,CACJ;AACF"}
@@ -0,0 +1,4 @@
1
+ export { SemanticFedRoot } from './SemanticFedRoot';
2
+ export type { SemanticFedRootProps, NavItem, FooterItem } from './types';
3
+ export { useSemanticFed } from './providers/SemanticFedProvider';
4
+ export { useSemanticFedStore } from './store/semanticfedStore';
@@ -1,3 +1,4 @@
1
- import "./providers/SemanticFedProvider.js";
2
- import "./store/semanticfedStore.js";
3
- import "./SemanticFedRoot.js";
1
+ import { SemanticFedRoot as e } from "./SemanticFedRoot.js";
2
+ import { useSemanticFed as t } from "./providers/SemanticFedProvider.js";
3
+ import { useSemanticFedStore as n } from "./store/semanticfedStore.js";
4
+ export { e as SemanticFedRoot, t as useSemanticFed, n as useSemanticFedStore };
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function AgentsPage(): React.JSX.Element;