@loopstack/loopstack-studio 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/app/EnvironmentEmbedRoot.js +20 -18
  2. package/dist/components/feedback/ErrorBoundary.js +43 -0
  3. package/dist/components/{LoadingCentered.js → feedback/LoadingCentered.js} +1 -1
  4. package/dist/components/feedback/index.js +5 -0
  5. package/dist/components/index.js +6 -3
  6. package/dist/components/layout/MainLayout.js +32 -16
  7. package/dist/components/layout/StudioSidebar.js +165 -0
  8. package/dist/components/ui-widgets/widgets/SandboxRun.js +1 -0
  9. package/dist/features/code-explorer/CodeExplorer.js +6 -0
  10. package/dist/features/code-explorer/components/CodeExplorerTree.js +5 -0
  11. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +6 -0
  12. package/dist/features/code-explorer/components/FileContentViewer.js +1 -0
  13. package/dist/features/code-explorer/components/FileTabsBar.js +1 -1
  14. package/dist/features/code-explorer/index.js +4 -0
  15. package/dist/features/debug/components/ConfigFlowViewer.js +1 -1
  16. package/dist/features/debug/components/PipelineFlowViewer.js +1 -1
  17. package/dist/features/debug/index.js +3 -0
  18. package/dist/features/documents/DocumentRenderer.js +53 -0
  19. package/dist/features/{workbench → documents}/components/DocumentItem.js +1 -1
  20. package/dist/features/{workbench → documents}/components/DocumentMetadataPills.js +2 -2
  21. package/dist/features/{workbench/components → documents}/document-details/DocumentDetails.js +3 -3
  22. package/dist/features/{workbench/components → documents}/document-details/PromptDetails.js +3 -3
  23. package/dist/features/documents/index.js +4 -0
  24. package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessage.js +5 -5
  25. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentDebugRenderer.js +1 -1
  26. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentFormRenderer.js +3 -3
  27. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentMessageRenderer.js +1 -1
  28. package/dist/features/{workbench/components/document-renderer → documents/renderers}/ErrorMessageRenderer.js +1 -1
  29. package/dist/features/{workbench/components/document-renderer → documents/renderers}/LinkMessageRenderer.js +1 -1
  30. package/dist/features/{workbench/components/document-renderer → documents/renderers}/MarkdownMessageRenderer.js +2 -2
  31. package/dist/features/{workbench/components/document-renderer → documents/renderers}/PlainMessageRenderer.js +1 -1
  32. package/dist/features/health/index.js +1 -0
  33. package/dist/features/workbench/NavigationItems.js +29 -29
  34. package/dist/features/workbench/Workbench.js +57 -69
  35. package/dist/features/workbench/WorkflowItem.js +63 -55
  36. package/dist/features/workbench/WorkflowList.js +52 -81
  37. package/dist/features/workbench/components/NewRunDialog.js +2 -1
  38. package/dist/features/workbench/components/WorkbenchFlowPanel.js +5 -4
  39. package/dist/features/workbench/components/WorkflowHistoryItem.js +11 -11
  40. package/dist/features/workbench/components/buttons/WorkflowButtons.js +49 -50
  41. package/dist/features/workbench/hooks/useWorkflowData.js +49 -0
  42. package/dist/features/workbench/hooks/useWorkflowListState.js +50 -0
  43. package/dist/features/workbench/index.js +8 -0
  44. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +2 -3
  45. package/dist/features/workspaces/components/CreateWorkspace.js +1 -1
  46. package/dist/features/workspaces/components/ExecutionTimeline.js +1 -1
  47. package/dist/features/workspaces/components/PipelineForm.js +1 -1
  48. package/dist/features/workspaces/index.js +3 -0
  49. package/dist/hooks/index.js +3 -2
  50. package/dist/hooks/query-keys.js +138 -0
  51. package/dist/hooks/useAuth.js +43 -42
  52. package/dist/hooks/useConfig.js +31 -35
  53. package/dist/hooks/useDashboard.js +9 -13
  54. package/dist/hooks/useDebounce.js +8 -17
  55. package/dist/hooks/useDocuments.js +4 -9
  56. package/dist/hooks/useFiles.js +31 -39
  57. package/dist/hooks/useNamespaces.js +2 -8
  58. package/dist/hooks/usePipelines.js +132 -155
  59. package/dist/hooks/useProcessor.js +11 -14
  60. package/dist/hooks/useWorkflows.js +40 -62
  61. package/dist/hooks/useWorkspaces.js +105 -110
  62. package/dist/index.d.ts +99 -3
  63. package/dist/index.js +14 -7
  64. package/dist/pages/DashboardPage.js +1 -1
  65. package/dist/pages/DebugWorkflowDetailsPage.js +2 -2
  66. package/dist/pages/EmbedWorkbenchPage.js +4 -3
  67. package/dist/pages/PipelineDebugPage.js +6 -5
  68. package/dist/pages/PreviewWorkbenchPage.js +121 -118
  69. package/dist/pages/RunsListPage.js +52 -24
  70. package/dist/pages/StudioLandingPage.js +1 -0
  71. package/dist/pages/WorkbenchPage.js +3 -2
  72. package/dist/pages/WorkspacePage.js +1 -1
  73. package/dist/providers/InvalidationEventsProvider.js +9 -11
  74. package/dist/providers/StudioProvider.js +2 -2
  75. package/dist/routing/LocalRouter.js +12 -8
  76. package/package.json +1 -1
  77. package/dist/features/workbench/components/DocumentRenderer.js +0 -54
  78. /package/dist/components/{content → feedback}/ErrorAlert.js +0 -0
  79. /package/dist/components/{snackbars → feedback}/ErrorSnackbar.js +0 -0
  80. /package/dist/components/{snackbars → feedback}/Snackbar.js +0 -0
  81. /package/dist/features/{workbench → documents}/components/DocumentList.js +0 -0
  82. /package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessageContent.js +0 -0
@@ -1,57 +1,58 @@
1
+ import { getHealthCacheKey, getMeCacheKey } from "./query-keys.js";
1
2
  import { useApiClient } from "./useApi.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
- function useMe(n) {
5
- let i = c(8), a = n === void 0 ? !0 : n, { envKey: o, api: s } = useApiClient(), l;
6
- i[0] === o ? l = i[1] : (l = ["me", o], i[0] = o, i[1] = l);
7
- let u;
8
- i[2] === s ? u = i[3] : (u = () => s.auth.me(), i[2] = s, i[3] = u);
5
+ function useMe(e) {
6
+ let i = c(8), o = e === void 0 ? !0 : e, { envKey: s, api: l } = useApiClient(), u;
7
+ i[0] === s ? u = i[1] : (u = getMeCacheKey(s), i[0] = s, i[1] = u);
9
8
  let d;
10
- return i[4] !== a || i[5] !== l || i[6] !== u ? (d = {
11
- queryKey: l,
12
- queryFn: u,
9
+ i[2] === l ? d = i[3] : (d = () => l.auth.me(), i[2] = l, i[3] = d);
10
+ let f;
11
+ return i[4] !== o || i[5] !== u || i[6] !== d ? (f = {
12
+ queryKey: u,
13
+ queryFn: d,
13
14
  retry: !1,
14
15
  staleTime: 3e5,
15
- enabled: a
16
- }, i[4] = a, i[5] = l, i[6] = u, i[7] = d) : d = i[7], useQuery(d);
16
+ enabled: o
17
+ }, i[4] = o, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useQuery(f);
17
18
  }
18
- function useGetHealthInfo(n) {
19
- let i = c(8), a = n === void 0 ? !0 : n, { envKey: o, api: s } = useApiClient(), l;
20
- i[0] === o ? l = i[1] : (l = ["health", o], i[0] = o, i[1] = l);
21
- let u;
22
- i[2] === s ? u = i[3] : (u = () => s.auth.getInfo(), i[2] = s, i[3] = u);
19
+ function useGetHealthInfo(r) {
20
+ let i = c(8), o = r === void 0 ? !0 : r, { envKey: s, api: l } = useApiClient(), u;
21
+ i[0] === s ? u = i[1] : (u = getHealthCacheKey(s), i[0] = s, i[1] = u);
23
22
  let d;
24
- return i[4] !== a || i[5] !== l || i[6] !== u ? (d = {
25
- queryKey: l,
26
- queryFn: u,
23
+ i[2] === l ? d = i[3] : (d = () => l.auth.getInfo(), i[2] = l, i[3] = d);
24
+ let f;
25
+ return i[4] !== o || i[5] !== u || i[6] !== d ? (f = {
26
+ queryKey: u,
27
+ queryFn: d,
27
28
  staleTime: 3e5,
28
- enabled: a
29
- }, i[4] = a, i[5] = l, i[6] = u, i[7] = d) : d = i[7], useQuery(d);
29
+ enabled: o
30
+ }, i[4] = o, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useQuery(f);
30
31
  }
31
32
  function useWorkerAuth() {
32
- let r = c(7), { api: a } = useApiClient(), o = useQueryClient(), s;
33
- r[0] === a ? s = r[1] : (s = (e) => a.auth.hubLogin(e), r[0] = a, r[1] = s);
34
- let l;
35
- r[2] === o ? l = r[3] : (l = () => {
36
- o.invalidateQueries();
37
- }, r[2] = o, r[3] = l);
38
- let u;
39
- return r[4] !== s || r[5] !== l ? (u = {
40
- mutationFn: s,
41
- onSuccess: l
42
- }, r[4] = s, r[5] = l, r[6] = u) : u = r[6], useMutation(u);
33
+ let a = c(8), { envKey: s, api: l } = useApiClient(), u = useQueryClient(), d;
34
+ a[0] === l ? d = a[1] : (d = (e) => l.auth.hubLogin(e), a[0] = l, a[1] = d);
35
+ let f;
36
+ a[2] !== s || a[3] !== u ? (f = () => {
37
+ u.invalidateQueries({ queryKey: getMeCacheKey(s) }), u.invalidateQueries({ queryKey: getHealthCacheKey(s) });
38
+ }, a[2] = s, a[3] = u, a[4] = f) : f = a[4];
39
+ let p;
40
+ return a[5] !== d || a[6] !== f ? (p = {
41
+ mutationFn: d,
42
+ onSuccess: f
43
+ }, a[5] = d, a[6] = f, a[7] = p) : p = a[7], useMutation(p);
43
44
  }
44
45
  function useWorkerAuthTokenRefresh() {
45
- let r = c(7), { api: a } = useApiClient(), o = useQueryClient(), s;
46
- r[0] === a ? s = r[1] : (s = () => a.auth.refresh(), r[0] = a, r[1] = s);
47
- let l;
48
- r[2] === o ? l = r[3] : (l = () => {
49
- o.invalidateQueries();
50
- }, r[2] = o, r[3] = l);
51
- let u;
52
- return r[4] !== s || r[5] !== l ? (u = {
53
- mutationFn: s,
54
- onSuccess: l
55
- }, r[4] = s, r[5] = l, r[6] = u) : u = r[6], useMutation(u);
46
+ let a = c(8), { envKey: s, api: l } = useApiClient(), u = useQueryClient(), d;
47
+ a[0] === l ? d = a[1] : (d = () => l.auth.refresh(), a[0] = l, a[1] = d);
48
+ let f;
49
+ a[2] !== s || a[3] !== u ? (f = () => {
50
+ u.invalidateQueries({ queryKey: getMeCacheKey(s) }), u.invalidateQueries({ queryKey: getHealthCacheKey(s) });
51
+ }, a[2] = s, a[3] = u, a[4] = f) : f = a[4];
52
+ let p;
53
+ return a[5] !== d || a[6] !== f ? (p = {
54
+ mutationFn: d,
55
+ onSuccess: f
56
+ }, a[5] = d, a[6] = f, a[7] = p) : p = a[7], useMutation(p);
56
57
  }
57
58
  export { useGetHealthInfo, useMe, useWorkerAuth, useWorkerAuthTokenRefresh };
@@ -1,44 +1,40 @@
1
+ import { getAvailableEnvironmentsCacheKey, getPipelineTypesCacheKey, getWorkspaceTypesCacheKey } from "./query-keys.js";
1
2
  import { useApiClient } from "./useApi.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { useQuery } from "@tanstack/react-query";
4
5
  function useWorkspaceConfig() {
5
- let r = c(7), { envKey: i, api: a } = useApiClient(), o;
6
- r[0] === i ? o = r[1] : (o = ["workspace-types", i], r[0] = i, r[1] = o);
7
- let s;
8
- r[2] === a ? s = r[3] : (s = () => a.config.getWorkspaceTypes(), r[2] = a, r[3] = s);
6
+ let e = c(7), { envKey: i, api: o } = useApiClient(), s;
7
+ e[0] === i ? s = e[1] : (s = getWorkspaceTypesCacheKey(i), e[0] = i, e[1] = s);
9
8
  let l;
10
- return r[4] !== o || r[5] !== s ? (l = {
11
- queryKey: o,
12
- queryFn: s,
13
- enabled: !0
14
- }, r[4] = o, r[5] = s, r[6] = l) : l = r[6], useQuery(l);
15
- }
16
- function usePipelineConfig(r) {
17
- let i = c(10), { envKey: a, api: o } = useApiClient(), s;
18
- i[0] !== a || i[1] !== r ? (s = [
19
- "pipeline-types",
20
- r,
21
- a
22
- ], i[0] = a, i[1] = r, i[2] = s) : s = i[2];
23
- let l;
24
- i[3] !== o || i[4] !== r ? (l = () => o.config.getPipelineTypesByWorkspace({ workspaceBlockName: r }), i[3] = o, i[4] = r, i[5] = l) : l = i[5];
25
- let u = !!r, d;
26
- return i[6] !== s || i[7] !== l || i[8] !== u ? (d = {
9
+ e[2] === o ? l = e[3] : (l = () => o.config.getWorkspaceTypes(), e[2] = o, e[3] = l);
10
+ let u;
11
+ return e[4] !== s || e[5] !== l ? (u = {
27
12
  queryKey: s,
28
- queryFn: l,
29
- enabled: u
30
- }, i[6] = s, i[7] = l, i[8] = u, i[9] = d) : d = i[9], useQuery(d);
13
+ queryFn: l
14
+ }, e[4] = s, e[5] = l, e[6] = u) : u = e[6], useQuery(u);
31
15
  }
32
- function useAvailableEnvironments(r) {
33
- let i = c(8), { envKey: a, api: o } = useApiClient(), s;
34
- i[0] === a ? s = i[1] : (s = ["available-environments", a], i[0] = a, i[1] = s);
35
- let l;
36
- i[2] === o ? l = i[3] : (l = () => o.config.getAvailableEnvironments(), i[2] = o, i[3] = l);
37
- let u = r?.enabled ?? !0, d;
38
- return i[4] !== s || i[5] !== l || i[6] !== u ? (d = {
39
- queryKey: s,
40
- queryFn: l,
41
- enabled: u
42
- }, i[4] = s, i[5] = l, i[6] = u, i[7] = d) : d = i[7], useQuery(d);
16
+ function usePipelineConfig(e) {
17
+ let a = c(10), { envKey: o, api: s } = useApiClient(), l;
18
+ a[0] !== o || a[1] !== e ? (l = getPipelineTypesCacheKey(o, e), a[0] = o, a[1] = e, a[2] = l) : l = a[2];
19
+ let u;
20
+ a[3] !== s || a[4] !== e ? (u = () => s.config.getPipelineTypesByWorkspace({ workspaceBlockName: e }), a[3] = s, a[4] = e, a[5] = u) : u = a[5];
21
+ let d = !!e, f;
22
+ return a[6] !== l || a[7] !== u || a[8] !== d ? (f = {
23
+ queryKey: l,
24
+ queryFn: u,
25
+ enabled: d
26
+ }, a[6] = l, a[7] = u, a[8] = d, a[9] = f) : f = a[9], useQuery(f);
27
+ }
28
+ function useAvailableEnvironments(i) {
29
+ let a = c(8), { envKey: o, api: s } = useApiClient(), l;
30
+ a[0] === o ? l = a[1] : (l = getAvailableEnvironmentsCacheKey(o), a[0] = o, a[1] = l);
31
+ let u;
32
+ a[2] === s ? u = a[3] : (u = () => s.config.getAvailableEnvironments(), a[2] = s, a[3] = u);
33
+ let d = i?.enabled ?? !0, f;
34
+ return a[4] !== l || a[5] !== u || a[6] !== d ? (f = {
35
+ queryKey: l,
36
+ queryFn: u,
37
+ enabled: d
38
+ }, a[4] = l, a[5] = u, a[6] = d, a[7] = f) : f = a[7], useQuery(f);
43
39
  }
44
40
  export { useAvailableEnvironments, usePipelineConfig, useWorkspaceConfig };
@@ -1,20 +1,16 @@
1
+ import { getDashboardStatsCacheKey } from "./query-keys.js";
1
2
  import { useApiClient } from "./useApi.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { useQuery } from "@tanstack/react-query";
4
5
  function useDashboardStats() {
5
- let r = c(7), { envKey: i, api: a } = useApiClient(), o;
6
- r[0] === i ? o = r[1] : (o = [
7
- "dashboard",
8
- "stats",
9
- i
10
- ], r[0] = i, r[1] = o);
11
- let s;
12
- r[2] === a ? s = r[3] : (s = () => a.dashboard.getStats(), r[2] = a, r[3] = s);
6
+ let i = c(7), { envKey: a, api: o } = useApiClient(), s;
7
+ i[0] === a ? s = i[1] : (s = getDashboardStatsCacheKey(a), i[0] = a, i[1] = s);
13
8
  let l;
14
- return r[4] !== o || r[5] !== s ? (l = {
15
- queryKey: o,
16
- queryFn: s,
17
- enabled: !0
18
- }, r[4] = o, r[5] = s, r[6] = l) : l = r[6], useQuery(l);
9
+ i[2] === o ? l = i[3] : (l = () => o.dashboard.getStats(), i[2] = o, i[3] = l);
10
+ let u;
11
+ return i[4] !== s || i[5] !== l ? (u = {
12
+ queryKey: s,
13
+ queryFn: l
14
+ }, i[4] = s, i[5] = l, i[6] = u) : u = i[6], useQuery(u);
19
15
  }
20
16
  export { useDashboardStats };
@@ -4,24 +4,15 @@ function useDebounce(r, i) {
4
4
  let a = c(4), o = i === void 0 ? 500 : i, [s, l] = useState(r), u, d;
5
5
  return a[0] !== o || a[1] !== r ? (u = () => {
6
6
  if (typeof r == "string") {
7
- let e = r;
8
- if (r === void 0 || e === "" || e.length >= 3) {
9
- let e = setTimeout(() => {
10
- l(r);
11
- }, o);
12
- return () => {
13
- clearTimeout(e);
14
- };
15
- }
16
- return;
17
- } else {
18
- let e = setTimeout(() => {
19
- l(r);
20
- }, o);
21
- return () => {
22
- clearTimeout(e);
23
- };
7
+ let e = r.length;
8
+ if (e > 0 && e < 3) return;
24
9
  }
10
+ let e = setTimeout(() => {
11
+ l(r);
12
+ }, o);
13
+ return () => {
14
+ clearTimeout(e);
15
+ };
25
16
  }, d = [r, o], a[0] = o, a[1] = r, a[2] = u, a[3] = d) : (u = a[2], d = a[3]), useEffect(u, d), s;
26
17
  }
27
18
  export { useDebounce };
@@ -1,13 +1,7 @@
1
+ import { getDocumentsCacheKey } from "./query-keys.js";
1
2
  import { useApiClient } from "./useApi.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { useQuery } from "@tanstack/react-query";
4
- function getDocumentsCacheKey(e, i) {
5
- return [
6
- "documents",
7
- e,
8
- i
9
- ];
10
- }
11
5
  function useFilterDocuments(a) {
12
6
  let o = c(15), { envKey: s, api: l } = useApiClient(), u;
13
7
  o[0] === a ? u = o[1] : (u = JSON.stringify({
@@ -27,15 +21,16 @@ function useFilterDocuments(a) {
27
21
  let p = f, m;
28
22
  o[5] !== s || o[6] !== a ? (m = getDocumentsCacheKey(s, a), o[5] = s, o[6] = a, o[7] = m) : m = o[7];
29
23
  let h;
30
- o[8] !== l || o[9] !== p ? (h = () => l.documents.getAll(p).then(_temp), o[8] = l, o[9] = p, o[10] = h) : h = o[10];
24
+ o[8] !== l || o[9] !== p ? (h = () => l.documents.getAll(p), o[8] = l, o[9] = p, o[10] = h) : h = o[10];
31
25
  let g = !!a, _;
32
26
  return o[11] !== m || o[12] !== h || o[13] !== g ? (_ = {
33
27
  queryKey: m,
34
28
  queryFn: h,
29
+ select: _temp,
35
30
  enabled: g
36
31
  }, o[11] = m, o[12] = h, o[13] = g, o[14] = _) : _ = o[14], useQuery(_);
37
32
  }
38
33
  function _temp(e) {
39
34
  return e.data;
40
35
  }
41
- export { getDocumentsCacheKey, useFilterDocuments };
36
+ export { useFilterDocuments };
@@ -1,53 +1,45 @@
1
+ import { getFileContentCacheKey, getFileTreeCacheKey } from "./query-keys.js";
1
2
  import { useApiClient } from "./useApi.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { useQuery } from "@tanstack/react-query";
4
- function useFileTree(r, a) {
5
- let o = c(10), s = a === void 0 ? !0 : a, { envKey: l, api: u } = useApiClient(), d;
6
- o[0] !== l || o[1] !== r ? (d = [
7
- "fileTree",
8
- r,
9
- l
10
- ], o[0] = l, o[1] = r, o[2] = d) : d = o[2];
11
- let f;
12
- o[3] !== u || o[4] !== r ? (f = () => {
13
- if (!r) throw Error("Pipeline ID is required");
14
- return u.pipelines.getFileTree({ pipelineId: r });
15
- }, o[3] = u, o[4] = r, o[5] = f) : f = o[5];
16
- let p = !!r && s, m;
17
- return o[6] !== d || o[7] !== f || o[8] !== p ? (m = {
18
- queryKey: d,
19
- queryFn: f,
20
- enabled: p,
5
+ function useFileTree(e, a) {
6
+ let s = c(10), l = a === void 0 ? !0 : a, { envKey: u, api: d } = useApiClient(), f;
7
+ s[0] !== u || s[1] !== e ? (f = getFileTreeCacheKey(u, e), s[0] = u, s[1] = e, s[2] = f) : f = s[2];
8
+ let p;
9
+ s[3] !== d || s[4] !== e ? (p = () => {
10
+ if (!e) throw Error("Pipeline ID is required");
11
+ return d.pipelines.getFileTree({ pipelineId: e });
12
+ }, s[3] = d, s[4] = e, s[5] = p) : p = s[5];
13
+ let m = !!e && l, h;
14
+ return s[6] !== f || s[7] !== p || s[8] !== m ? (h = {
15
+ queryKey: f,
16
+ queryFn: p,
17
+ enabled: m,
21
18
  staleTime: 3e5,
22
19
  refetchOnMount: !1,
23
20
  refetchOnWindowFocus: !1,
24
21
  placeholderData: _temp
25
- }, o[6] = d, o[7] = f, o[8] = p, o[9] = m) : m = o[9], useQuery(m);
22
+ }, s[6] = f, s[7] = p, s[8] = m, s[9] = h) : h = s[9], useQuery(h);
26
23
  }
27
24
  function _temp(e) {
28
25
  return e;
29
26
  }
30
- function useFileContent(r, i, a) {
31
- let o = c(12), s = a === void 0 ? !0 : a, { envKey: l, api: u } = useApiClient(), d;
32
- o[0] !== l || o[1] !== i || o[2] !== r ? (d = [
33
- "fileContent",
34
- r,
35
- i,
36
- l
37
- ], o[0] = l, o[1] = i, o[2] = r, o[3] = d) : d = o[3];
38
- let f;
39
- o[4] !== u || o[5] !== i || o[6] !== r ? (f = () => {
40
- if (!r || !i) throw Error("Pipeline ID and file path are required");
41
- return u.pipelines.getFileContent({
42
- pipelineId: r,
43
- filePath: i
27
+ function useFileContent(i, a, o) {
28
+ let s = c(12), l = o === void 0 ? !0 : o, { envKey: u, api: d } = useApiClient(), f;
29
+ s[0] !== u || s[1] !== a || s[2] !== i ? (f = getFileContentCacheKey(u, i, a), s[0] = u, s[1] = a, s[2] = i, s[3] = f) : f = s[3];
30
+ let p;
31
+ s[4] !== d || s[5] !== a || s[6] !== i ? (p = () => {
32
+ if (!i || !a) throw Error("Pipeline ID and file path are required");
33
+ return d.pipelines.getFileContent({
34
+ pipelineId: i,
35
+ filePath: a
44
36
  });
45
- }, o[4] = u, o[5] = i, o[6] = r, o[7] = f) : f = o[7];
46
- let p = !!r && !!i && s, m;
47
- return o[8] !== d || o[9] !== f || o[10] !== p ? (m = {
48
- queryKey: d,
49
- queryFn: f,
50
- enabled: p
51
- }, o[8] = d, o[9] = f, o[10] = p, o[11] = m) : m = o[11], useQuery(m);
37
+ }, s[4] = d, s[5] = a, s[6] = i, s[7] = p) : p = s[7];
38
+ let m = !!i && !!a && l, h;
39
+ return s[8] !== f || s[9] !== p || s[10] !== m ? (h = {
40
+ queryKey: f,
41
+ queryFn: p,
42
+ enabled: m
43
+ }, s[8] = f, s[9] = p, s[10] = m, s[11] = h) : h = s[11], useQuery(h);
52
44
  }
53
45
  export { useFileContent, useFileTree };
@@ -1,13 +1,7 @@
1
+ import { getNamespacesByPipelineCacheKey } from "./query-keys.js";
1
2
  import { useApiClient } from "./useApi.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { useQuery } from "@tanstack/react-query";
4
- function getNamespacesByPipelineCacheKey(e, i) {
5
- return [
6
- "namespaces",
7
- e,
8
- i
9
- ];
10
- }
11
5
  function useFilterNamespaces(a) {
12
6
  let o = c(14), { envKey: s, api: l } = useApiClient(), u;
13
7
  o[0] === a ? u = o[1] : (u = JSON.stringify({ pipelineId: a }), o[0] = a, o[1] = u);
@@ -28,4 +22,4 @@ function useFilterNamespaces(a) {
28
22
  function _temp(e) {
29
23
  return e.data;
30
24
  }
31
- export { getNamespacesByPipelineCacheKey, useFilterNamespaces };
25
+ export { useFilterNamespaces };