@loopstack/loopstack-studio 0.21.3 → 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 (126) hide show
  1. package/dist/api/auth.js +10 -0
  2. package/dist/api/client.js +13 -0
  3. package/dist/api/config.js +10 -0
  4. package/dist/api/dashboard.js +4 -0
  5. package/dist/api/documents.js +7 -0
  6. package/dist/api/index.js +24 -0
  7. package/dist/api/namespaces.js +7 -0
  8. package/dist/api/pipelines.js +13 -0
  9. package/dist/api/processor.js +4 -0
  10. package/dist/api/workflows.js +8 -0
  11. package/dist/api/workspaces.js +12 -0
  12. package/dist/app/EnvironmentEmbedRoot.js +35 -0
  13. package/dist/components/data-table/DataTableFilters.js +74 -63
  14. package/dist/components/feedback/ErrorBoundary.js +43 -0
  15. package/dist/components/{LoadingCentered.js → feedback/LoadingCentered.js} +1 -1
  16. package/dist/components/feedback/index.js +5 -0
  17. package/dist/components/index.js +6 -3
  18. package/dist/components/layout/MainLayout.js +36 -17
  19. package/dist/components/layout/StudioSidebar.js +165 -0
  20. package/dist/components/page/PageBreadcrumbs.js +1 -1
  21. package/dist/components/ui/sidebar.js +359 -359
  22. package/dist/components/ui-widgets/UiActions.js +22 -15
  23. package/dist/components/ui-widgets/UiWidget.js +31 -26
  24. package/dist/components/ui-widgets/widgets/AiPromptInput.js +27 -27
  25. package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +12 -12
  26. package/dist/components/ui-widgets/widgets/SandboxRun.js +33 -0
  27. package/dist/components/ui-widgets/widgets/SubmitButton.js +11 -11
  28. package/dist/features/code-explorer/CodeExplorer.js +4 -67
  29. package/dist/features/code-explorer/components/CodeExplorerTree.js +3 -41
  30. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +4 -80
  31. package/dist/features/code-explorer/components/FileContentViewer.js +1 -0
  32. package/dist/features/code-explorer/components/FileTabsBar.js +1 -1
  33. package/dist/features/code-explorer/index.js +4 -0
  34. package/dist/features/code-explorer/utils/fileIcons.js +4 -7
  35. package/dist/features/debug/components/ConfigFlowViewer.js +1 -1
  36. package/dist/features/debug/components/PipelineFlowViewer.js +1 -1
  37. package/dist/features/debug/index.js +3 -0
  38. package/dist/features/documents/DocumentRenderer.js +53 -0
  39. package/dist/features/{workbench → documents}/components/DocumentItem.js +1 -1
  40. package/dist/features/documents/components/DocumentList.js +40 -0
  41. package/dist/features/{workbench → documents}/components/DocumentMetadataPills.js +2 -2
  42. package/dist/features/{workbench/components → documents}/document-details/DocumentDetails.js +3 -3
  43. package/dist/features/{workbench/components → documents}/document-details/PromptDetails.js +3 -3
  44. package/dist/features/documents/index.js +4 -0
  45. package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessage.js +5 -5
  46. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentDebugRenderer.js +1 -1
  47. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentFormRenderer.js +9 -8
  48. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentMessageRenderer.js +1 -1
  49. package/dist/features/{workbench/components/document-renderer → documents/renderers}/ErrorMessageRenderer.js +1 -1
  50. package/dist/features/{workbench/components/document-renderer → documents/renderers}/LinkMessageRenderer.js +1 -1
  51. package/dist/features/{workbench/components/document-renderer → documents/renderers}/MarkdownMessageRenderer.js +2 -2
  52. package/dist/features/{workbench/components/document-renderer → documents/renderers}/PlainMessageRenderer.js +1 -1
  53. package/dist/features/health/index.js +1 -0
  54. package/dist/features/oauth/OAuthPromptRenderer.js +1 -1
  55. package/dist/features/runs/Runs.js +197 -0
  56. package/dist/features/workbench/NavigationItems.js +29 -29
  57. package/dist/features/workbench/Workbench.js +100 -78
  58. package/dist/features/workbench/WorkflowItem.js +63 -58
  59. package/dist/features/workbench/WorkflowList.js +62 -82
  60. package/dist/features/workbench/components/NewRunDialog.js +329 -0
  61. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +88 -0
  62. package/dist/features/workbench/components/WorkbenchFlowPanel.js +49 -0
  63. package/dist/features/workbench/components/WorkbenchIconSidebar.js +68 -0
  64. package/dist/features/workbench/components/WorkbenchPreviewPanel.js +128 -0
  65. package/dist/features/workbench/components/WorkflowForms.js +7 -6
  66. package/dist/features/workbench/components/WorkflowHistoryItem.js +74 -69
  67. package/dist/features/workbench/components/buttons/WorkflowButtons.js +78 -61
  68. package/dist/features/workbench/hooks/useWorkflowData.js +49 -0
  69. package/dist/features/workbench/hooks/useWorkflowListState.js +50 -0
  70. package/dist/features/workbench/index.js +8 -0
  71. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +76 -0
  72. package/dist/features/workspaces/Workspaces.js +2 -2
  73. package/dist/features/workspaces/components/CreateWorkspace.js +165 -82
  74. package/dist/features/workspaces/components/EnvironmentSlotSelector.js +63 -0
  75. package/dist/features/workspaces/components/ExecutionTimeline.js +70 -69
  76. package/dist/features/workspaces/components/PipelineForm.js +4 -4
  77. package/dist/features/workspaces/index.js +3 -0
  78. package/dist/hooks/index.js +3 -0
  79. package/dist/hooks/query-keys.js +138 -0
  80. package/dist/hooks/useApi.js +9 -33
  81. package/dist/hooks/useAuth.js +37 -56
  82. package/dist/hooks/useConfig.js +27 -33
  83. package/dist/hooks/useDashboard.js +9 -16
  84. package/dist/hooks/useDebounce.js +8 -17
  85. package/dist/hooks/useDocuments.js +7 -16
  86. package/dist/hooks/useFiles.js +24 -42
  87. package/dist/hooks/useNamespaces.js +7 -16
  88. package/dist/hooks/usePipelines.js +141 -174
  89. package/dist/hooks/useProcessor.js +11 -17
  90. package/dist/hooks/useWorkflows.js +51 -89
  91. package/dist/hooks/useWorkspaces.js +97 -129
  92. package/dist/index.d.ts +364 -50
  93. package/dist/index.js +21 -6
  94. package/dist/packages/contracts/dist/enums/index.js +25 -0
  95. package/dist/packages/contracts/dist/enums/pipeline-state.js +10 -0
  96. package/dist/packages/contracts/dist/enums/registry.enum.js +20 -0
  97. package/dist/packages/contracts/dist/enums/sort-order.enum.js +10 -0
  98. package/dist/packages/contracts/dist/enums/user-type.enum.js +10 -0
  99. package/dist/packages/contracts/dist/enums/workflow-state.enum.js +10 -0
  100. package/dist/pages/DashboardPage.js +1 -1
  101. package/dist/pages/DebugPage.js +12 -14
  102. package/dist/pages/DebugWorkflowDetailsPage.js +2 -2
  103. package/dist/pages/DebugWorkflowsPage.js +3 -4
  104. package/dist/pages/EmbedWorkbenchPage.js +7 -5
  105. package/dist/pages/PipelineDebugPage.js +7 -6
  106. package/dist/pages/PreviewWorkbenchPage.js +419 -0
  107. package/dist/pages/RunsListPage.js +64 -0
  108. package/dist/pages/RunsPage.js +49 -0
  109. package/dist/pages/StudioLandingPage.js +146 -0
  110. package/dist/pages/WorkbenchPage.js +78 -53
  111. package/dist/pages/WorkspacePage.js +1 -1
  112. package/dist/providers/InvalidationEventsProvider.js +15 -17
  113. package/dist/providers/QueryProvider.js +21 -0
  114. package/dist/providers/StudioProvider.js +2 -2
  115. package/dist/routing/LocalRouter.js +20 -7
  116. package/dist/services/createApiClient.js +4 -10
  117. package/dist/services/index.js +1 -1
  118. package/package.json +2 -3
  119. package/dist/features/workbench/components/DocumentList.js +0 -40
  120. package/dist/features/workbench/components/DocumentRenderer.js +0 -54
  121. package/dist/features/workbench/components/WorkbenchSidebar.js +0 -109
  122. package/dist/features/workbench/providers/WorkbenchContextProvider.js +0 -3
  123. /package/dist/components/{content → feedback}/ErrorAlert.js +0 -0
  124. /package/dist/components/{snackbars → feedback}/ErrorSnackbar.js +0 -0
  125. /package/dist/components/{snackbars → feedback}/Snackbar.js +0 -0
  126. /package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessageContent.js +0 -0
@@ -1,194 +1,161 @@
1
+ import { getPipelineCacheKey, getPipelineConfigCacheKey, getPipelineSourceCacheKey, getPipelinesCacheKey, getPipelinesChildrenCacheKey } 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 usePipeline(n) {
5
- let i = c(10), { envKey: a, api: s } = useApiClient(), l;
6
- i[0] !== a || i[1] !== n ? (l = [
7
- "pipeline",
8
- n,
9
- a
10
- ], i[0] = a, i[1] = n, i[2] = l) : l = i[2];
5
+ function usePipeline(r) {
6
+ let i = c(10), { envKey: a, api: o } = useApiClient(), s;
7
+ i[0] !== a || i[1] !== r ? (s = getPipelineCacheKey(a, r), i[0] = a, i[1] = r, i[2] = s) : s = i[2];
11
8
  let u;
12
- i[3] !== s || i[4] !== n ? (u = () => {
13
- if (!s) throw Error("API not available");
14
- return s.ApiV1PipelinesApi.pipelineControllerGetPipelineById({ id: n });
15
- }, i[3] = s, i[4] = n, i[5] = u) : u = i[5];
16
- let d = !!n, f;
17
- return i[6] !== l || i[7] !== u || i[8] !== d ? (f = {
18
- queryKey: l,
9
+ i[3] !== o || i[4] !== r ? (u = () => o.pipelines.getById({ id: r }), i[3] = o, i[4] = r, i[5] = u) : u = i[5];
10
+ let d = !!r, f;
11
+ return i[6] !== s || i[7] !== u || i[8] !== d ? (f = {
12
+ queryKey: s,
19
13
  queryFn: u,
20
- enabled: d,
21
- select: _temp
22
- }, i[6] = l, i[7] = u, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
14
+ enabled: d
15
+ }, i[6] = s, i[7] = u, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
23
16
  }
24
- function _temp(e) {
25
- return e.data;
26
- }
27
- function useFilterPipelines(n, i, a, o, s, d) {
28
- let f = c(23), p = a === void 0 ? "id" : a, m = o === void 0 ? "DESC" : o, h = s === void 0 ? 0 : s, g = d === void 0 ? 10 : d, { envKey: _, api: v } = useApiClient(), y = Object.values(i).some(_temp2), b;
29
- f[0] !== i || f[1] !== y ? (b = y && { filter: JSON.stringify(i) }, f[0] = i, f[1] = y, f[2] = b) : b = f[2];
30
- let x;
31
- f[3] !== m || f[4] !== p ? (x = JSON.stringify([{
32
- field: p,
33
- order: m
34
- }]), f[3] = m, f[4] = p, f[5] = x) : x = f[5];
17
+ function useFilterPipelines(e, r, i, o, s, u) {
18
+ let d = c(30), f = i === void 0 ? "id" : i, p = o === void 0 ? "DESC" : o, m = s === void 0 ? 0 : s, h = u === void 0 ? 10 : u, { envKey: g, api: _ } = useApiClient(), v = Object.keys(r).length > 0, y;
19
+ d[0] !== r || d[1] !== v ? (y = v ? JSON.stringify(r) : void 0, d[0] = r, d[1] = v, d[2] = y) : y = d[2];
20
+ let b = y, x;
21
+ d[3] === b ? x = d[4] : (x = b && { filter: b }, d[3] = b, d[4] = x);
35
22
  let S;
36
- f[6] === n ? S = f[7] : (S = n && {
37
- search: n,
38
- searchColumns: JSON.stringify(["title", "model"])
39
- }, f[6] = n, f[7] = S);
23
+ d[5] !== p || d[6] !== f ? (S = JSON.stringify([{
24
+ field: f,
25
+ order: p
26
+ }]), d[5] = p, d[6] = f, d[7] = S) : S = d[7];
40
27
  let C;
41
- f[8] !== g || f[9] !== h || f[10] !== b || f[11] !== x || f[12] !== S ? (C = {
42
- ...b,
43
- sortBy: x,
44
- page: h,
45
- limit: g,
46
- ...S
47
- }, f[8] = g, f[9] = h, f[10] = b, f[11] = x, f[12] = S, f[13] = C) : C = f[13];
48
- let w = C, T;
49
- f[14] !== _ || f[15] !== w ? (T = [
50
- "pipelines",
51
- w,
52
- _
53
- ], f[14] = _, f[15] = w, f[16] = T) : T = f[16];
54
- let E;
55
- f[17] !== v || f[18] !== w ? (E = () => {
56
- if (!v) throw Error("API not available");
57
- return v.ApiV1PipelinesApi.pipelineControllerGetPipelines(w);
58
- }, f[17] = v, f[18] = w, f[19] = E) : E = f[19];
28
+ d[8] === e ? C = d[9] : (C = e && {
29
+ search: e,
30
+ searchColumns: JSON.stringify(["title", "model"])
31
+ }, d[8] = e, d[9] = C);
32
+ let w;
33
+ d[10] !== h || d[11] !== m || d[12] !== x || d[13] !== S || d[14] !== C ? (w = {
34
+ ...x,
35
+ sortBy: S,
36
+ page: m,
37
+ limit: h,
38
+ ...C
39
+ }, d[10] = h, d[11] = m, d[12] = x, d[13] = S, d[14] = C, d[15] = w) : w = d[15];
40
+ let T = w, E;
41
+ d[16] !== g || d[17] !== b || d[18] !== h || d[19] !== p || d[20] !== m || d[21] !== e || d[22] !== f ? (E = [
42
+ ...getPipelinesCacheKey(g),
43
+ "list",
44
+ e ?? "",
45
+ b ?? "",
46
+ f,
47
+ p,
48
+ m,
49
+ h
50
+ ], d[16] = g, d[17] = b, d[18] = h, d[19] = p, d[20] = m, d[21] = e, d[22] = f, d[23] = E) : E = d[23];
59
51
  let D;
60
- return f[20] !== T || f[21] !== E ? (D = {
61
- queryKey: T,
62
- queryFn: E,
63
- select: _temp3,
64
- enabled: !0
65
- }, f[20] = T, f[21] = E, f[22] = D) : D = f[22], useQuery(D);
66
- }
67
- function _temp3(e) {
68
- return e.data;
69
- }
70
- function _temp2(e) {
71
- return e != null;
52
+ d[24] !== _ || d[25] !== T ? (D = () => _.pipelines.getAll(T), d[24] = _, d[25] = T, d[26] = D) : D = d[26];
53
+ let O;
54
+ return d[27] !== D || d[28] !== E ? (O = {
55
+ queryKey: E,
56
+ queryFn: D
57
+ }, d[27] = D, d[28] = E, d[29] = O) : O = d[29], useQuery(O);
72
58
  }
73
59
  function useCreatePipeline() {
74
- let r = c(8), { envKey: a, api: o } = useApiClient(), s = useQueryClient(), l;
75
- r[0] === o ? l = r[1] : (l = (e) => {
76
- if (!o) throw Error("API not available");
77
- return o.ApiV1PipelinesApi.pipelineControllerCreatePipeline(e);
78
- }, r[0] = o, r[1] = l);
79
- let u;
80
- r[2] !== a || r[3] !== s ? (u = () => {
81
- s.invalidateQueries({ queryKey: ["pipelines", a] });
82
- }, r[2] = a, r[3] = s, r[4] = u) : u = r[4];
60
+ let e = c(8), { envKey: r, api: i } = useApiClient(), o = useQueryClient(), l;
61
+ e[0] === i ? l = e[1] : (l = (e) => i.pipelines.create(e), e[0] = i, e[1] = l);
83
62
  let d;
84
- return r[5] !== l || r[6] !== u ? (d = {
63
+ e[2] !== r || e[3] !== o ? (d = () => {
64
+ o.invalidateQueries({ queryKey: getPipelinesCacheKey(r) });
65
+ }, e[2] = r, e[3] = o, e[4] = d) : d = e[4];
66
+ let f;
67
+ return e[5] !== l || e[6] !== d ? (f = {
85
68
  mutationFn: l,
86
- onSuccess: u
87
- }, r[5] = l, r[6] = u, r[7] = d) : d = r[7], useMutation(d);
69
+ onSuccess: d
70
+ }, e[5] = l, e[6] = d, e[7] = f) : f = e[7], useMutation(f);
88
71
  }
89
- function usePipelineConfig(n, i) {
90
- let a = c(12), { envKey: o, api: s } = useApiClient(), l;
91
- a[0] !== o || a[1] !== i || a[2] !== n ? (l = [
92
- "pipelineConfig",
93
- n,
94
- i,
95
- o
96
- ], a[0] = o, a[1] = i, a[2] = n, a[3] = l) : l = a[3];
97
- let u;
98
- a[4] !== s || a[5] !== i || a[6] !== n ? (u = () => {
99
- if (!s) throw Error("API not available");
100
- return s.ApiV1ConfigApi.configControllerGetPipelineConfigByName({
101
- workspaceBlockName: n,
102
- pipelineName: i
103
- });
104
- }, a[4] = s, a[5] = i, a[6] = n, a[7] = u) : u = a[7];
105
- let d = !!n && !!i, f;
106
- return a[8] !== l || a[9] !== u || a[10] !== d ? (f = {
107
- queryKey: l,
108
- queryFn: u,
109
- enabled: d,
110
- select: _temp4
111
- }, a[8] = l, a[9] = u, a[10] = d, a[11] = f) : f = a[11], useQuery(f);
112
- }
113
- function _temp4(e) {
114
- return e.data;
72
+ function useUpdatePipeline() {
73
+ let r = c(8), { envKey: i, api: o } = useApiClient(), l = useQueryClient(), d;
74
+ r[0] === o ? d = r[1] : (d = (e) => o.pipelines.update(e), r[0] = o, r[1] = d);
75
+ let f;
76
+ r[2] !== i || r[3] !== l ? (f = (r, o) => {
77
+ l.invalidateQueries({ queryKey: getPipelineCacheKey(i, o.id) }), l.invalidateQueries({ queryKey: getPipelinesCacheKey(i) });
78
+ }, r[2] = i, r[3] = l, r[4] = f) : f = r[4];
79
+ let p;
80
+ return r[5] !== d || r[6] !== f ? (p = {
81
+ mutationFn: d,
82
+ onSuccess: f
83
+ }, r[5] = d, r[6] = f, r[7] = p) : p = r[7], useMutation(p);
115
84
  }
116
- function useBatchDeletePipeline() {
117
- let r = c(7), { api: a } = useApiClient(), o = useQueryClient(), s;
118
- r[0] === a ? s = r[1] : (s = (e) => {
119
- if (!a) throw Error("API not available");
120
- return a.ApiV1PipelinesApi.pipelineControllerBatchDeletePipelines({ pipelineControllerBatchDeletePipelinesRequest: { ids: e } });
121
- }, r[0] = a, r[1] = s);
122
- let l;
123
- r[2] === o ? l = r[3] : (l = () => {
124
- o.invalidateQueries({
125
- queryKey: ["pipelines"],
126
- type: "all"
127
- });
128
- }, r[2] = o, r[3] = l);
129
- let u;
130
- return r[4] !== s || r[5] !== l ? (u = {
131
- mutationFn: s,
132
- onSuccess: l
133
- }, r[4] = s, r[5] = l, r[6] = u) : u = r[6], useMutation(u);
85
+ function usePipelineConfigByName(e, i) {
86
+ let a = c(12), { envKey: o, api: s } = useApiClient(), u;
87
+ a[0] !== o || a[1] !== i || a[2] !== e ? (u = getPipelineConfigCacheKey(o, e, i), a[0] = o, a[1] = i, a[2] = e, a[3] = u) : u = a[3];
88
+ let d;
89
+ a[4] !== s || a[5] !== i || a[6] !== e ? (d = () => s.config.getPipelineConfigByName({
90
+ workspaceBlockName: e,
91
+ pipelineName: i
92
+ }), a[4] = s, a[5] = i, a[6] = e, a[7] = d) : d = a[7];
93
+ let f = !!e && !!i, p;
94
+ return a[8] !== u || a[9] !== d || a[10] !== f ? (p = {
95
+ queryKey: u,
96
+ queryFn: d,
97
+ enabled: f
98
+ }, a[8] = u, a[9] = d, a[10] = f, a[11] = p) : p = a[11], useQuery(p);
134
99
  }
135
- function useChildPipelines(n, i) {
136
- let a = c(10), { envKey: o, api: s } = useApiClient(), l;
137
- a[0] !== o || a[1] !== n ? (l = [
138
- "pipelines",
139
- "children",
140
- n,
141
- o
142
- ], a[0] = o, a[1] = n, a[2] = l) : l = a[2];
143
- let u;
144
- a[3] !== s || a[4] !== n ? (u = () => {
145
- if (!s) throw Error("API not available");
146
- return s.ApiV1PipelinesApi.pipelineControllerGetPipelines({
147
- filter: JSON.stringify({ parentId: n }),
148
- sortBy: JSON.stringify([{
149
- field: "createdAt",
150
- order: "ASC"
151
- }]),
152
- page: 0,
153
- limit: 100
154
- });
155
- }, a[3] = s, a[4] = n, a[5] = u) : u = a[5];
156
- let d = i && !!n, f;
157
- return a[6] !== l || a[7] !== u || a[8] !== d ? (f = {
158
- queryKey: l,
159
- queryFn: u,
160
- enabled: d,
161
- select: _temp5
162
- }, a[6] = l, a[7] = u, a[8] = d, a[9] = f) : f = a[9], useQuery(f);
100
+ function useDeletePipeline() {
101
+ let r = c(8), { envKey: i, api: o } = useApiClient(), l = useQueryClient(), d;
102
+ r[0] === o ? d = r[1] : (d = (e) => o.pipelines.delete({ id: e }), r[0] = o, r[1] = d);
103
+ let f;
104
+ r[2] !== i || r[3] !== l ? (f = (r, o) => {
105
+ l.removeQueries({ queryKey: getPipelineCacheKey(i, o) }), l.invalidateQueries({ queryKey: getPipelinesCacheKey(i) });
106
+ }, r[2] = i, r[3] = l, r[4] = f) : f = r[4];
107
+ let p;
108
+ return r[5] !== d || r[6] !== f ? (p = {
109
+ mutationFn: d,
110
+ onSuccess: f
111
+ }, r[5] = d, r[6] = f, r[7] = p) : p = r[7], useMutation(p);
163
112
  }
164
- function _temp5(e) {
165
- return e.data;
113
+ function useBatchDeletePipeline() {
114
+ let e = c(8), { envKey: r, api: i } = useApiClient(), o = useQueryClient(), l;
115
+ e[0] === i ? l = e[1] : (l = (e) => i.pipelines.batchDelete({ ids: e }), e[0] = i, e[1] = l);
116
+ let d;
117
+ e[2] !== r || e[3] !== o ? (d = () => {
118
+ o.invalidateQueries({ queryKey: getPipelinesCacheKey(r) });
119
+ }, e[2] = r, e[3] = o, e[4] = d) : d = e[4];
120
+ let f;
121
+ return e[5] !== l || e[6] !== d ? (f = {
122
+ mutationFn: l,
123
+ onSuccess: d
124
+ }, e[5] = l, e[6] = d, e[7] = f) : f = e[7], useMutation(f);
166
125
  }
167
- function usePipelineSource(n, i) {
168
- let a = c(12), { envKey: o, api: s } = useApiClient(), l;
169
- a[0] !== o || a[1] !== i || a[2] !== n ? (l = [
170
- "pipelineSource",
171
- n,
172
- i,
173
- o
174
- ], a[0] = o, a[1] = i, a[2] = n, a[3] = l) : l = a[3];
175
- let u;
176
- a[4] !== s || a[5] !== i || a[6] !== n ? (u = () => {
177
- if (!s) throw Error("API not available");
178
- return s.ApiV1ConfigApi.configControllerGetPipelineSourceByName({
179
- workspaceBlockName: n,
180
- pipelineName: i
181
- });
182
- }, a[4] = s, a[5] = i, a[6] = n, a[7] = u) : u = a[7];
183
- let d = !!n && !!i, f;
184
- return a[8] !== l || a[9] !== u || a[10] !== d ? (f = {
185
- queryKey: l,
186
- queryFn: u,
187
- enabled: d,
188
- select: _temp6
189
- }, a[8] = l, a[9] = u, a[10] = d, a[11] = f) : f = a[11], useQuery(f);
126
+ function useChildPipelines(e, r) {
127
+ let i = c(10), { envKey: a, api: s } = useApiClient(), u;
128
+ i[0] !== a || i[1] !== e ? (u = getPipelinesChildrenCacheKey(a, e), i[0] = a, i[1] = e, i[2] = u) : u = i[2];
129
+ let d;
130
+ i[3] !== s || i[4] !== e ? (d = () => s.pipelines.getAll({
131
+ filter: JSON.stringify({ parentId: e }),
132
+ sortBy: JSON.stringify([{
133
+ field: "createdAt",
134
+ order: "ASC"
135
+ }]),
136
+ page: 0,
137
+ limit: 100
138
+ }), i[3] = s, i[4] = e, i[5] = d) : d = i[5];
139
+ let f = r && !!e, p;
140
+ return i[6] !== u || i[7] !== d || i[8] !== f ? (p = {
141
+ queryKey: u,
142
+ queryFn: d,
143
+ enabled: f
144
+ }, i[6] = u, i[7] = d, i[8] = f, i[9] = p) : p = i[9], useQuery(p);
190
145
  }
191
- function _temp6(e) {
192
- return e.data;
146
+ function usePipelineSource(e, r) {
147
+ let a = c(12), { envKey: o, api: s } = useApiClient(), u;
148
+ a[0] !== o || a[1] !== r || a[2] !== e ? (u = getPipelineSourceCacheKey(o, e, r), a[0] = o, a[1] = r, a[2] = e, a[3] = u) : u = a[3];
149
+ let d;
150
+ a[4] !== s || a[5] !== r || a[6] !== e ? (d = () => s.config.getPipelineSourceByName({
151
+ workspaceBlockName: e,
152
+ pipelineName: r
153
+ }), a[4] = s, a[5] = r, a[6] = e, a[7] = d) : d = a[7];
154
+ let f = !!e && !!r, p;
155
+ return a[8] !== u || a[9] !== d || a[10] !== f ? (p = {
156
+ queryKey: u,
157
+ queryFn: d,
158
+ enabled: f
159
+ }, a[8] = u, a[9] = d, a[10] = f, a[11] = p) : p = a[11], useQuery(p);
193
160
  }
194
- export { useBatchDeletePipeline, useChildPipelines, useCreatePipeline, useFilterPipelines, usePipeline, usePipelineConfig, usePipelineSource };
161
+ export { useBatchDeletePipeline, useChildPipelines, useCreatePipeline, useDeletePipeline, useFilterPipelines, usePipeline, usePipelineConfigByName, usePipelineSource, useUpdatePipeline };
@@ -1,24 +1,18 @@
1
+ import { getPipelinesCacheKey } from "./query-keys.js";
1
2
  import { useApiClient } from "./useApi.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { useMutation, useQueryClient } from "@tanstack/react-query";
4
5
  function useRunPipeline() {
5
- let a = c(7), { api: o } = useApiClient(), s = useQueryClient(), l;
6
- a[0] === o ? l = a[1] : (l = (e) => {
7
- if (!o) throw Error("API not available");
8
- return o.ApiV1ProcessorApi.processorControllerRunPipeline(e);
9
- }, a[0] = o, a[1] = l);
10
- let u;
11
- a[2] === s ? u = a[3] : (u = () => {
12
- console.log("success"), s.invalidateQueries({ queryKey: ["pipelines"] });
13
- }, a[2] = s, a[3] = u);
6
+ let a = c(8), { envKey: o, api: s } = useApiClient(), l = useQueryClient(), u;
7
+ a[0] === s ? u = a[1] : (u = (e) => s.processor.runPipeline(e), a[0] = s, a[1] = u);
14
8
  let d;
15
- return a[4] !== l || a[5] !== u ? (d = {
16
- mutationFn: l,
17
- onSuccess: u,
18
- onError: _temp
19
- }, a[4] = l, a[5] = u, a[6] = d) : d = a[6], useMutation(d);
20
- }
21
- function _temp(e) {
22
- console.error("Error:", e);
9
+ a[2] !== o || a[3] !== l ? (d = () => {
10
+ l.invalidateQueries({ queryKey: getPipelinesCacheKey(o) });
11
+ }, a[2] = o, a[3] = l, a[4] = d) : d = a[4];
12
+ let f;
13
+ return a[5] !== u || a[6] !== d ? (f = {
14
+ mutationFn: u,
15
+ onSuccess: d
16
+ }, a[5] = u, a[6] = d, a[7] = f) : f = a[7], useMutation(f);
23
17
  }
24
18
  export { useRunPipeline };
@@ -1,122 +1,84 @@
1
+ import { getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey } 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 getWorkflowsCacheKey(e, t) {
5
- return [
6
- "workflows",
7
- e,
8
- t
9
- ];
10
- }
11
- function getWorkflowCacheKey(e, t) {
12
- return [
13
- "workflow",
14
- e,
15
- t
16
- ];
17
- }
18
- function getWorkflowsByPipelineCacheKey(e, t) {
19
- return [
20
- "workflows-by-pipeline",
21
- e,
22
- t
23
- ];
24
- }
25
- function useWorkflow(n) {
26
- let i = c(10), { envKey: a, api: s } = useApiClient(), l;
27
- i[0] !== a || i[1] !== n ? (l = getWorkflowCacheKey(a, n), i[0] = a, i[1] = n, i[2] = l) : l = i[2];
28
- let d;
29
- i[3] !== s || i[4] !== n ? (d = () => {
30
- if (!s) throw Error("API not available");
31
- return s.ApiV1WorkflowsApi.workflowControllerGetWorkflowById({ id: n });
32
- }, i[3] = s, i[4] = n, i[5] = d) : d = i[5];
33
- let f = !!n, p;
34
- return i[6] !== l || i[7] !== d || i[8] !== f ? (p = {
5
+ function useWorkflow(t) {
6
+ let n = c(10), { envKey: a, api: s } = useApiClient(), l;
7
+ n[0] !== a || n[1] !== t ? (l = getWorkflowCacheKey(a, t), n[0] = a, n[1] = t, n[2] = l) : l = n[2];
8
+ let u;
9
+ n[3] !== s || n[4] !== t ? (u = () => s.workflows.getById({ id: t }), n[3] = s, n[4] = t, n[5] = u) : u = n[5];
10
+ let d = !!t, f;
11
+ return n[6] !== l || n[7] !== u || n[8] !== d ? (f = {
35
12
  queryKey: l,
36
- queryFn: d,
37
- enabled: f,
38
- select: _temp
39
- }, i[6] = l, i[7] = d, i[8] = f, i[9] = p) : p = i[9], useQuery(p);
40
- }
41
- function _temp(e) {
42
- return e.data;
13
+ queryFn: u,
14
+ enabled: d
15
+ }, n[6] = l, n[7] = u, n[8] = d, n[9] = f) : f = n[9], useQuery(f);
43
16
  }
44
- function useFetchWorkflowsByPipeline(n) {
45
- let i = c(14), { envKey: a, api: o } = useApiClient(), l;
46
- i[0] === n ? l = i[1] : (l = JSON.stringify({ pipelineId: n }), i[0] = n, i[1] = l);
17
+ function useFetchWorkflowsByPipeline(e) {
18
+ let n = c(14), { envKey: a, api: s } = useApiClient(), l;
19
+ n[0] === e ? l = n[1] : (l = JSON.stringify({ pipelineId: e }), n[0] = e, n[1] = l);
47
20
  let u;
48
- i[2] === Symbol.for("react.memo_cache_sentinel") ? (u = JSON.stringify([{
21
+ n[2] === Symbol.for("react.memo_cache_sentinel") ? (u = JSON.stringify([{
49
22
  field: "index",
50
23
  order: "ASC"
51
- }]), i[2] = u) : u = i[2];
52
- let d;
53
- i[3] === l ? d = i[4] : (d = {
24
+ }]), n[2] = u) : u = n[2];
25
+ let f;
26
+ n[3] === l ? f = n[4] : (f = {
54
27
  filter: l,
55
28
  sortBy: u
56
- }, i[3] = l, i[4] = d);
57
- let p = d, m;
58
- i[5] !== a || i[6] !== n ? (m = getWorkflowsByPipelineCacheKey(a, n), i[5] = a, i[6] = n, i[7] = m) : m = i[7];
29
+ }, n[3] = l, n[4] = f);
30
+ let p = f, m;
31
+ n[5] !== a || n[6] !== e ? (m = getWorkflowsByPipelineCacheKey(a, e), n[5] = a, n[6] = e, n[7] = m) : m = n[7];
59
32
  let h;
60
- i[8] !== o || i[9] !== p ? (h = () => {
61
- if (!o) throw Error("API not available");
62
- return o.ApiV1WorkflowsApi.workflowControllerGetWorkflows(p);
63
- }, i[8] = o, i[9] = p, i[10] = h) : h = i[10];
33
+ n[8] !== s || n[9] !== p ? (h = () => s.workflows.getAll(p), n[8] = s, n[9] = p, n[10] = h) : h = n[10];
64
34
  let g;
65
- return i[11] !== m || i[12] !== h ? (g = {
35
+ return n[11] !== m || n[12] !== h ? (g = {
66
36
  queryKey: m,
67
37
  queryFn: h,
68
- select: _temp2,
69
- enabled: !0
70
- }, i[11] = m, i[12] = h, i[13] = g) : g = i[13], useQuery(g);
38
+ select: _temp
39
+ }, n[11] = m, n[12] = h, n[13] = g) : g = n[13], useQuery(g);
71
40
  }
72
- function _temp2(e) {
73
- return e.data.data;
41
+ function _temp(e) {
42
+ return e.data;
74
43
  }
75
- function useFetchWorkflowsByNamespace(n) {
76
- let i = c(14), { envKey: o, api: s } = useApiClient(), l;
77
- i[0] === n ? l = i[1] : (l = JSON.stringify({ namespaceId: n }), i[0] = n, i[1] = l);
44
+ function useFetchWorkflowsByNamespace(e) {
45
+ let t = c(14), { envKey: a, api: s } = useApiClient(), l;
46
+ t[0] === e ? l = t[1] : (l = JSON.stringify({ namespaceId: e }), t[0] = e, t[1] = l);
78
47
  let u;
79
- i[2] === Symbol.for("react.memo_cache_sentinel") ? (u = JSON.stringify([{
48
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (u = JSON.stringify([{
80
49
  field: "index",
81
50
  order: "ASC"
82
- }]), i[2] = u) : u = i[2];
51
+ }]), t[2] = u) : u = t[2];
83
52
  let d;
84
- i[3] === l ? d = i[4] : (d = {
53
+ t[3] === l ? d = t[4] : (d = {
85
54
  filter: l,
86
55
  sortBy: u
87
- }, i[3] = l, i[4] = d);
88
- let f = d, p;
89
- i[5] !== o || i[6] !== n ? (p = getWorkflowsCacheKey(o, n), i[5] = o, i[6] = n, i[7] = p) : p = i[7];
56
+ }, t[3] = l, t[4] = d);
57
+ let f = d, m;
58
+ t[5] !== a || t[6] !== e ? (m = getWorkflowsCacheKey(a, e), t[5] = a, t[6] = e, t[7] = m) : m = t[7];
90
59
  let h;
91
- i[8] !== s || i[9] !== f ? (h = () => {
92
- if (!s) throw Error("API not available");
93
- return s.ApiV1WorkflowsApi.workflowControllerGetWorkflows(f);
94
- }, i[8] = s, i[9] = f, i[10] = h) : h = i[10];
60
+ t[8] !== s || t[9] !== f ? (h = () => s.workflows.getAll(f), t[8] = s, t[9] = f, t[10] = h) : h = t[10];
95
61
  let g;
96
- return i[11] !== p || i[12] !== h ? (g = {
97
- queryKey: p,
62
+ return t[11] !== m || t[12] !== h ? (g = {
63
+ queryKey: m,
98
64
  queryFn: h,
99
- select: _temp3,
100
- enabled: !0
101
- }, i[11] = p, i[12] = h, i[13] = g) : g = i[13], useQuery(g);
65
+ select: _temp2
66
+ }, t[11] = m, t[12] = h, t[13] = g) : g = t[13], useQuery(g);
102
67
  }
103
- function _temp3(e) {
104
- return e.data.data;
68
+ function _temp2(e) {
69
+ return e.data;
105
70
  }
106
71
  function useDeleteWorkflow() {
107
- let r = c(8), { envKey: l, api: u } = useApiClient(), d = useQueryClient(), f;
108
- r[0] === u ? f = r[1] : (f = (e) => {
109
- if (!u) throw Error("API not available");
110
- return u.ApiV1WorkflowsApi.workflowControllerDeleteWorkflow({ id: e.id });
111
- }, r[0] = u, r[1] = f);
72
+ let o = c(8), { envKey: l, api: u } = useApiClient(), d = useQueryClient(), f;
73
+ o[0] === u ? f = o[1] : (f = (e) => u.workflows.delete({ id: e.id }), o[0] = u, o[1] = f);
112
74
  let p;
113
- r[2] !== l || r[3] !== d ? (p = (e, t) => {
114
- d.removeQueries({ queryKey: getWorkflowCacheKey(l, t.id) }), d.invalidateQueries({ queryKey: getWorkflowsCacheKey(l, t.namespaceId) }), d.invalidateQueries({ queryKey: getWorkflowsByPipelineCacheKey(l, t.pipelineId) });
115
- }, r[2] = l, r[3] = d, r[4] = p) : p = r[4];
75
+ o[2] !== l || o[3] !== d ? (p = (r, i) => {
76
+ d.removeQueries({ queryKey: getWorkflowCacheKey(l, i.id) }), d.invalidateQueries({ queryKey: getWorkflowsCacheKey(l, i.namespaceId) }), d.invalidateQueries({ queryKey: getWorkflowsByPipelineCacheKey(l, i.pipelineId) });
77
+ }, o[2] = l, o[3] = d, o[4] = p) : p = o[4];
116
78
  let m;
117
- return r[5] !== f || r[6] !== p ? (m = {
79
+ return o[5] !== f || o[6] !== p ? (m = {
118
80
  mutationFn: f,
119
81
  onSuccess: p
120
- }, r[5] = f, r[6] = p, r[7] = m) : m = r[7], useMutation(m);
82
+ }, o[5] = f, o[6] = p, o[7] = m) : m = o[7], useMutation(m);
121
83
  }
122
- export { getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey, useDeleteWorkflow, useFetchWorkflowsByNamespace, useFetchWorkflowsByPipeline, useWorkflow };
84
+ export { useDeleteWorkflow, useFetchWorkflowsByNamespace, useFetchWorkflowsByPipeline, useWorkflow };