@burdenoff/microfe-bigconsole 2026.1004.2 → 2026.1004.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bigconsole/BigConsoleRoutes.d.ts +1 -1
- package/dist/bigconsole/BigConsoleRoutes.d.ts.map +1 -1
- package/dist/bigconsole/BigConsoleRoutes.js +15 -1
- package/dist/bigconsole/BigConsoleRoutes.js.map +1 -1
- package/dist/bigconsole/components/DrilldownModal.d.ts.map +1 -1
- package/dist/bigconsole/components/DrilldownModal.js +54 -53
- package/dist/bigconsole/components/DrilldownModal.js.map +1 -1
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.d.ts +3 -1
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.d.ts.map +1 -1
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +40 -39
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.js.map +1 -1
- package/dist/bigconsole/components/dashboard/DashboardCanvas.d.ts.map +1 -1
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js +184 -177
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js.map +1 -1
- package/dist/bigconsole/components/dashboard/DashboardGrid.d.ts.map +1 -1
- package/dist/bigconsole/components/dashboard/DashboardGrid.js +40 -22
- package/dist/bigconsole/components/dashboard/DashboardGrid.js.map +1 -1
- package/dist/bigconsole/components/dashboard/ExportDashboardDialog.d.ts.map +1 -1
- package/dist/bigconsole/components/dashboard/ExportDashboardDialog.js +31 -25
- package/dist/bigconsole/components/dashboard/ExportDashboardDialog.js.map +1 -1
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterEditor.d.ts +1 -1
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterEditor.d.ts.map +1 -1
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterEditor.js +115 -80
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterEditor.js.map +1 -1
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.d.ts.map +1 -1
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.js +177 -146
- package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.js.map +1 -1
- package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.d.ts +1 -1
- package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.d.ts.map +1 -1
- package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +375 -325
- package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js.map +1 -1
- package/dist/bigconsole/components/datasink/CacheTTLSelector.d.ts.map +1 -1
- package/dist/bigconsole/components/datasink/CacheTTLSelector.js +7 -1
- package/dist/bigconsole/components/datasink/CacheTTLSelector.js.map +1 -1
- package/dist/bigconsole/components/parser/ParserSelector.d.ts +3 -1
- package/dist/bigconsole/components/parser/ParserSelector.d.ts.map +1 -1
- package/dist/bigconsole/components/parser/ParserSelector.js +94 -94
- package/dist/bigconsole/components/parser/ParserSelector.js.map +1 -1
- package/dist/bigconsole/components/pipeline/PipelineCard.d.ts.map +1 -1
- package/dist/bigconsole/components/pipeline/PipelineCard.js +111 -89
- package/dist/bigconsole/components/pipeline/PipelineCard.js.map +1 -1
- package/dist/bigconsole/components/pipeline/PipelineScopePicker.d.ts +8 -0
- package/dist/bigconsole/components/pipeline/PipelineScopePicker.d.ts.map +1 -0
- package/dist/bigconsole/components/pipeline/PipelineScopePicker.js +52 -0
- package/dist/bigconsole/components/pipeline/PipelineScopePicker.js.map +1 -0
- package/dist/bigconsole/components/widgets/PropertiesPanel.d.ts.map +1 -1
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +257 -221
- package/dist/bigconsole/components/widgets/PropertiesPanel.js.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetHeader.d.ts +1 -0
- package/dist/bigconsole/components/widgets/WidgetHeader.d.ts.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetHeader.js +29 -29
- package/dist/bigconsole/components/widgets/WidgetHeader.js.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetWrapper.d.ts +2 -0
- package/dist/bigconsole/components/widgets/WidgetWrapper.d.ts.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +247 -239
- package/dist/bigconsole/components/widgets/WidgetWrapper.js.map +1 -1
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.d.ts.map +1 -1
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js +6 -4
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js.map +1 -1
- package/dist/bigconsole/components/widgets/states/EmptyState.d.ts +1 -0
- package/dist/bigconsole/components/widgets/states/EmptyState.d.ts.map +1 -1
- package/dist/bigconsole/components/widgets/states/EmptyState.js +4 -4
- package/dist/bigconsole/components/widgets/states/EmptyState.js.map +1 -1
- package/dist/bigconsole/components/workflow/WorkflowDesignPreview.d.ts +7 -0
- package/dist/bigconsole/components/workflow/WorkflowDesignPreview.d.ts.map +1 -0
- package/dist/bigconsole/components/workflow/WorkflowDesignPreview.js +94 -0
- package/dist/bigconsole/components/workflow/WorkflowDesignPreview.js.map +1 -0
- package/dist/bigconsole/components/workflow/WorkflowSinkLinkForm.d.ts +7 -0
- package/dist/bigconsole/components/workflow/WorkflowSinkLinkForm.d.ts.map +1 -0
- package/dist/bigconsole/components/workflow/WorkflowSinkLinkForm.js +101 -0
- package/dist/bigconsole/components/workflow/WorkflowSinkLinkForm.js.map +1 -0
- package/dist/bigconsole/hooks/useBigConsoleSettings.d.ts +16 -0
- package/dist/bigconsole/hooks/useBigConsoleSettings.d.ts.map +1 -0
- package/dist/bigconsole/hooks/useBigConsoleSettings.js +57 -0
- package/dist/bigconsole/hooks/useBigConsoleSettings.js.map +1 -0
- package/dist/bigconsole/hooks/useDashboardOperations.d.ts.map +1 -1
- package/dist/bigconsole/hooks/useDashboardOperations.js +102 -79
- package/dist/bigconsole/hooks/useDashboardOperations.js.map +1 -1
- package/dist/bigconsole/hooks/useExportDashboard.d.ts +3 -1
- package/dist/bigconsole/hooks/useExportDashboard.d.ts.map +1 -1
- package/dist/bigconsole/hooks/useExportDashboard.js +23 -13
- package/dist/bigconsole/hooks/useExportDashboard.js.map +1 -1
- package/dist/bigconsole/hooks/useFilterUrlSync.d.ts +18 -0
- package/dist/bigconsole/hooks/useFilterUrlSync.d.ts.map +1 -1
- package/dist/bigconsole/hooks/useFilterUrlSync.js +87 -57
- package/dist/bigconsole/hooks/useFilterUrlSync.js.map +1 -1
- package/dist/bigconsole/hooks/useGlobalFilters.d.ts.map +1 -1
- package/dist/bigconsole/hooks/useGlobalFilters.js +39 -29
- package/dist/bigconsole/hooks/useGlobalFilters.js.map +1 -1
- package/dist/bigconsole/hooks/usePageOperations.d.ts.map +1 -1
- package/dist/bigconsole/hooks/usePageOperations.js +1 -0
- package/dist/bigconsole/hooks/usePageOperations.js.map +1 -1
- package/dist/bigconsole/hooks/usePipelineOperations.d.ts.map +1 -1
- package/dist/bigconsole/hooks/usePipelineOperations.js +114 -112
- package/dist/bigconsole/hooks/usePipelineOperations.js.map +1 -1
- package/dist/bigconsole/hooks/useShareRecipients.d.ts +22 -0
- package/dist/bigconsole/hooks/useShareRecipients.d.ts.map +1 -0
- package/dist/bigconsole/hooks/useShareRecipients.js +198 -0
- package/dist/bigconsole/hooks/useShareRecipients.js.map +1 -0
- package/dist/bigconsole/pages/DashboardBuilderPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/DashboardBuilderPage.js +198 -193
- package/dist/bigconsole/pages/DashboardBuilderPage.js.map +1 -1
- package/dist/bigconsole/pages/DashboardViewPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/DashboardViewPage.js +171 -167
- package/dist/bigconsole/pages/DashboardViewPage.js.map +1 -1
- package/dist/bigconsole/pages/DashboardsPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/DashboardsPage.js +313 -266
- package/dist/bigconsole/pages/DashboardsPage.js.map +1 -1
- package/dist/bigconsole/pages/DataSinkBuilderPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/DataSinkBuilderPage.js +84 -79
- package/dist/bigconsole/pages/DataSinkBuilderPage.js.map +1 -1
- package/dist/bigconsole/pages/DataSinkViewPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/DataSinkViewPage.js +267 -257
- package/dist/bigconsole/pages/DataSinkViewPage.js.map +1 -1
- package/dist/bigconsole/pages/InsightsPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/InsightsPage.js +465 -402
- package/dist/bigconsole/pages/InsightsPage.js.map +1 -1
- package/dist/bigconsole/pages/PipelineBuilderPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/PipelineBuilderPage.js +169 -157
- package/dist/bigconsole/pages/PipelineBuilderPage.js.map +1 -1
- package/dist/bigconsole/pages/PipelineViewPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/PipelineViewPage.js +370 -230
- package/dist/bigconsole/pages/PipelineViewPage.js.map +1 -1
- package/dist/bigconsole/pages/PipelinesPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/PipelinesPage.js +181 -151
- package/dist/bigconsole/pages/PipelinesPage.js.map +1 -1
- package/dist/bigconsole/pages/SettingsPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/SettingsPage.js +188 -208
- package/dist/bigconsole/pages/SettingsPage.js.map +1 -1
- package/dist/bigconsole/pages/WidgetDemoPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/WidgetDemoPage.js +134 -117
- package/dist/bigconsole/pages/WidgetDemoPage.js.map +1 -1
- package/dist/bigconsole/pages/WorkflowViewPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/WorkflowViewPage.js +315 -267
- package/dist/bigconsole/pages/WorkflowViewPage.js.map +1 -1
- package/dist/bigconsole/pages/WorkflowsPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/WorkflowsPage.js +4 -3
- package/dist/bigconsole/pages/WorkflowsPage.js.map +1 -1
- package/dist/bigconsole/types/index.d.ts +4 -0
- package/dist/bigconsole/types/index.d.ts.map +1 -1
- package/dist/generated/wspace-operations.d.ts +148 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +172 -133
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +21 -0
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/microfe-bigconsole.css +1 -1
- package/dist/translations/en.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,63 +1,65 @@
|
|
|
1
1
|
import { usePipelineStore as e } from "../store/pipelineStore.js";
|
|
2
2
|
import { CreatePipelineDocument as t, DeletePipelineDocument as n, ExecutePipelineDocument as r, GetPipelineDocument as i, GetPipelineExecutionDocument as a, ListPipelineExecutionsDocument as o, ListPipelinesDocument as s, TestPipelineDocument as c, UpdatePipelineDocument as l } from "../../generated/wspace-operations.js";
|
|
3
|
-
import { useCallback as u, useEffect as d, useMemo as f,
|
|
4
|
-
import { useApolloClient as
|
|
3
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
4
|
+
import { useApolloClient as h } from "@apollo/client/react";
|
|
5
5
|
//#region src/bigconsole/hooks/usePipelineOperations.ts
|
|
6
|
-
function
|
|
7
|
-
let { consoleId:
|
|
8
|
-
if (!
|
|
6
|
+
function g(g = {}) {
|
|
7
|
+
let { consoleId: _, skipFetch: v = !1 } = g, [y, b] = m(!1), [x, S] = m(null), C = h(), w = e((e) => e.pipelines), T = e((e) => e.setPipelines), E = e((e) => e.addPipeline), D = e((e) => e.updatePipeline), O = e((e) => e.removePipeline), k = e((e) => e.updateStage), A = e((e) => e.removeStage), j = e((e) => e.setPipelineTesting), M = e((e) => e.setTestExecution), N = e((e) => e.setIsTestRunning), P = p(0), F = f(() => Array.from(w.values()).filter((e) => !_ || e.consoleId === _), [w, _]), I = u(async (e) => {
|
|
8
|
+
if (!_) return [];
|
|
9
|
+
let t = ++P.current;
|
|
9
10
|
try {
|
|
10
|
-
|
|
11
|
-
let
|
|
11
|
+
b(!0), S(null);
|
|
12
|
+
let n = ((await C.query({
|
|
12
13
|
query: s,
|
|
13
14
|
variables: {
|
|
14
|
-
consoleId:
|
|
15
|
+
consoleId: _,
|
|
15
16
|
status: e?.status,
|
|
16
17
|
first: 100
|
|
17
18
|
},
|
|
18
19
|
fetchPolicy: "network-only"
|
|
19
20
|
})).data?.listPipelines?.edges || []).map((e) => e.node);
|
|
20
|
-
return
|
|
21
|
+
return t === P.current ? (T(n), n) : [];
|
|
21
22
|
} catch (e) {
|
|
22
|
-
|
|
23
|
+
let n = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch pipelines");
|
|
24
|
+
return t === P.current && S(n), [];
|
|
23
25
|
} finally {
|
|
24
|
-
|
|
26
|
+
t === P.current && b(!1);
|
|
25
27
|
}
|
|
26
28
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
]),
|
|
29
|
+
C,
|
|
30
|
+
_,
|
|
31
|
+
T
|
|
32
|
+
]), L = u(async (e) => {
|
|
31
33
|
try {
|
|
32
|
-
|
|
33
|
-
let t = (await
|
|
34
|
+
b(!0), S(null);
|
|
35
|
+
let t = (await C.query({
|
|
34
36
|
query: i,
|
|
35
37
|
variables: { id: e },
|
|
36
38
|
fetchPolicy: "network-only"
|
|
37
39
|
})).data?.pipeline;
|
|
38
|
-
return t ? (
|
|
40
|
+
return t ? (E(t), t) : null;
|
|
39
41
|
} catch (e) {
|
|
40
|
-
return
|
|
42
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch pipeline")), null;
|
|
41
43
|
} finally {
|
|
42
|
-
|
|
44
|
+
b(!1);
|
|
43
45
|
}
|
|
44
|
-
}, [
|
|
46
|
+
}, [C, E]), R = u(async (e) => {
|
|
45
47
|
try {
|
|
46
|
-
|
|
47
|
-
let n = (await
|
|
48
|
+
b(!0), S(null);
|
|
49
|
+
let n = (await C.mutate({
|
|
48
50
|
mutation: t,
|
|
49
51
|
variables: { input: e }
|
|
50
52
|
})).data?.createPipeline;
|
|
51
|
-
return n ? (
|
|
53
|
+
return n ? (E(n), n) : null;
|
|
52
54
|
} catch (e) {
|
|
53
|
-
return
|
|
55
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to create pipeline")), null;
|
|
54
56
|
} finally {
|
|
55
|
-
|
|
57
|
+
b(!1);
|
|
56
58
|
}
|
|
57
|
-
}, [
|
|
59
|
+
}, [C, E]), z = u(async (e, t, n) => {
|
|
58
60
|
try {
|
|
59
|
-
|
|
60
|
-
let r = (await
|
|
61
|
+
b(!0), S(null);
|
|
62
|
+
let r = (await C.mutate({
|
|
61
63
|
mutation: l,
|
|
62
64
|
variables: {
|
|
63
65
|
id: e,
|
|
@@ -65,27 +67,27 @@ function h(h = {}) {
|
|
|
65
67
|
version: n
|
|
66
68
|
}
|
|
67
69
|
})).data?.updatePipeline;
|
|
68
|
-
return r ? (
|
|
70
|
+
return r ? (D(e, r), r) : null;
|
|
69
71
|
} catch (e) {
|
|
70
|
-
return
|
|
72
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to update pipeline")), null;
|
|
71
73
|
} finally {
|
|
72
|
-
|
|
74
|
+
b(!1);
|
|
73
75
|
}
|
|
74
|
-
}, [
|
|
76
|
+
}, [C, D]), B = u(async (e) => {
|
|
75
77
|
try {
|
|
76
|
-
return
|
|
78
|
+
return b(!0), S(null), await C.mutate({
|
|
77
79
|
mutation: n,
|
|
78
80
|
variables: { id: e }
|
|
79
|
-
}),
|
|
81
|
+
}), O(e), !0;
|
|
80
82
|
} catch (e) {
|
|
81
|
-
return
|
|
83
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to delete pipeline")), !1;
|
|
82
84
|
} finally {
|
|
83
|
-
|
|
85
|
+
b(!1);
|
|
84
86
|
}
|
|
85
|
-
}, [
|
|
87
|
+
}, [C, O]), V = u(async (e, n, r) => {
|
|
86
88
|
try {
|
|
87
|
-
|
|
88
|
-
let i = (await
|
|
89
|
+
b(!0), S(null);
|
|
90
|
+
let i = (await C.mutate({
|
|
89
91
|
mutation: t,
|
|
90
92
|
variables: {
|
|
91
93
|
pipelineId: e,
|
|
@@ -93,16 +95,16 @@ function h(h = {}) {
|
|
|
93
95
|
version: r
|
|
94
96
|
}
|
|
95
97
|
})).data?.addPipelineStage;
|
|
96
|
-
return i ? (
|
|
98
|
+
return i ? (D(e, i), i) : null;
|
|
97
99
|
} catch (e) {
|
|
98
|
-
return
|
|
100
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to add stage")), null;
|
|
99
101
|
} finally {
|
|
100
|
-
|
|
102
|
+
b(!1);
|
|
101
103
|
}
|
|
102
|
-
}, [
|
|
104
|
+
}, [C, D]), H = u(async (e, t, n) => {
|
|
103
105
|
try {
|
|
104
|
-
|
|
105
|
-
let r = (await
|
|
106
|
+
b(!0), S(null);
|
|
107
|
+
let r = (await C.mutate({
|
|
106
108
|
mutation: l,
|
|
107
109
|
variables: {
|
|
108
110
|
stageId: e,
|
|
@@ -111,51 +113,51 @@ function h(h = {}) {
|
|
|
111
113
|
}
|
|
112
114
|
})).data?.updatePipelineStage;
|
|
113
115
|
if (r) {
|
|
114
|
-
let t = Array.from(
|
|
116
|
+
let t = Array.from(w.values()).find((t) => t.stages?.some((t) => t.id === e));
|
|
115
117
|
if (t) {
|
|
116
118
|
let n = t.stages?.findIndex((t) => t.id === e);
|
|
117
|
-
n !== void 0 && n >= 0 &&
|
|
119
|
+
n !== void 0 && n >= 0 && k(t.id, n, r);
|
|
118
120
|
}
|
|
119
121
|
return r;
|
|
120
122
|
}
|
|
121
123
|
return null;
|
|
122
124
|
} catch (e) {
|
|
123
|
-
return
|
|
125
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to update stage")), null;
|
|
124
126
|
} finally {
|
|
125
|
-
|
|
127
|
+
b(!1);
|
|
126
128
|
}
|
|
127
129
|
}, [
|
|
128
|
-
S,
|
|
129
130
|
C,
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
w,
|
|
132
|
+
k
|
|
133
|
+
]), U = u(async (e, t) => {
|
|
132
134
|
try {
|
|
133
|
-
|
|
135
|
+
b(!0), S(null), await C.mutate({
|
|
134
136
|
mutation: n,
|
|
135
137
|
variables: {
|
|
136
138
|
stageId: e,
|
|
137
139
|
version: t
|
|
138
140
|
}
|
|
139
141
|
});
|
|
140
|
-
let r = Array.from(
|
|
142
|
+
let r = Array.from(w.values()).find((t) => t.stages?.some((t) => t.id === e));
|
|
141
143
|
if (r) {
|
|
142
144
|
let t = r.stages?.findIndex((t) => t.id === e);
|
|
143
|
-
t !== void 0 && t >= 0 &&
|
|
145
|
+
t !== void 0 && t >= 0 && A(r.id, t);
|
|
144
146
|
}
|
|
145
147
|
return !0;
|
|
146
148
|
} catch (e) {
|
|
147
|
-
return
|
|
149
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to remove stage")), !1;
|
|
148
150
|
} finally {
|
|
149
|
-
|
|
151
|
+
b(!1);
|
|
150
152
|
}
|
|
151
153
|
}, [
|
|
152
|
-
S,
|
|
153
154
|
C,
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
w,
|
|
156
|
+
A
|
|
157
|
+
]), W = u(async (e, t, n) => {
|
|
156
158
|
try {
|
|
157
|
-
|
|
158
|
-
let r = (await
|
|
159
|
+
b(!0), S(null);
|
|
160
|
+
let r = (await C.mutate({
|
|
159
161
|
mutation: l,
|
|
160
162
|
variables: {
|
|
161
163
|
pipelineId: e,
|
|
@@ -163,56 +165,56 @@ function h(h = {}) {
|
|
|
163
165
|
version: n
|
|
164
166
|
}
|
|
165
167
|
})).data?.reorderPipelineStages;
|
|
166
|
-
return r ? (
|
|
168
|
+
return r ? (D(e, r), r) : null;
|
|
167
169
|
} catch (e) {
|
|
168
|
-
return
|
|
170
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to reorder stages")), null;
|
|
169
171
|
} finally {
|
|
170
|
-
|
|
172
|
+
b(!1);
|
|
171
173
|
}
|
|
172
|
-
}, [
|
|
174
|
+
}, [C, D]), G = u(async (e) => {
|
|
173
175
|
try {
|
|
174
|
-
|
|
175
|
-
let t = (await
|
|
176
|
+
b(!0), S(null), N(!0), j(e.pipelineId, !0);
|
|
177
|
+
let t = (await C.mutate({
|
|
176
178
|
mutation: c,
|
|
177
179
|
variables: { input: e }
|
|
178
180
|
})).data?.testPipeline;
|
|
179
|
-
return t ? (
|
|
181
|
+
return t ? (M(t), t) : null;
|
|
180
182
|
} catch (e) {
|
|
181
|
-
return
|
|
183
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to test pipeline")), null;
|
|
182
184
|
} finally {
|
|
183
|
-
|
|
185
|
+
b(!1), N(!1), j(e.pipelineId, !1);
|
|
184
186
|
}
|
|
185
187
|
}, [
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
]),
|
|
188
|
+
C,
|
|
189
|
+
N,
|
|
190
|
+
j,
|
|
191
|
+
M
|
|
192
|
+
]), K = u(async (e) => {
|
|
191
193
|
try {
|
|
192
|
-
return
|
|
194
|
+
return b(!0), S(null), j(e.pipelineId, !0), (await C.mutate({
|
|
193
195
|
mutation: r,
|
|
194
196
|
variables: { input: e }
|
|
195
197
|
})).data?.executePipeline || null;
|
|
196
198
|
} catch (e) {
|
|
197
|
-
return
|
|
199
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to execute pipeline")), null;
|
|
198
200
|
} finally {
|
|
199
|
-
|
|
201
|
+
b(!1), j(e.pipelineId, !1);
|
|
200
202
|
}
|
|
201
|
-
}, [
|
|
203
|
+
}, [C, j]), q = u(async (e) => {
|
|
202
204
|
try {
|
|
203
|
-
return
|
|
205
|
+
return b(!0), S(null), (await C.query({
|
|
204
206
|
query: a,
|
|
205
207
|
variables: { id: e },
|
|
206
208
|
fetchPolicy: "network-only"
|
|
207
209
|
})).data?.pipelineExecution || null;
|
|
208
210
|
} catch (e) {
|
|
209
|
-
return
|
|
211
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to get execution")), null;
|
|
210
212
|
} finally {
|
|
211
|
-
|
|
213
|
+
b(!1);
|
|
212
214
|
}
|
|
213
|
-
}, [
|
|
215
|
+
}, [C]), J = u(async (e) => {
|
|
214
216
|
try {
|
|
215
|
-
return
|
|
217
|
+
return b(!0), S(null), (await C.query({
|
|
216
218
|
query: o,
|
|
217
219
|
variables: {
|
|
218
220
|
pipelineId: e,
|
|
@@ -221,40 +223,40 @@ function h(h = {}) {
|
|
|
221
223
|
fetchPolicy: "network-only"
|
|
222
224
|
})).data?.listPipelineExecutions || [];
|
|
223
225
|
} catch (e) {
|
|
224
|
-
return
|
|
226
|
+
return S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to list executions")), [];
|
|
225
227
|
} finally {
|
|
226
|
-
|
|
228
|
+
b(!1);
|
|
227
229
|
}
|
|
228
|
-
}, [
|
|
229
|
-
await
|
|
230
|
-
}, [
|
|
230
|
+
}, [C]), Y = u(async () => {
|
|
231
|
+
await I();
|
|
232
|
+
}, [I]);
|
|
231
233
|
return d(() => {
|
|
232
|
-
|
|
234
|
+
_ && !v && I();
|
|
233
235
|
}, [
|
|
234
|
-
g,
|
|
235
236
|
_,
|
|
236
|
-
|
|
237
|
+
v,
|
|
238
|
+
I
|
|
237
239
|
]), {
|
|
238
|
-
loading:
|
|
239
|
-
error:
|
|
240
|
-
pipelines:
|
|
241
|
-
fetchPipelines:
|
|
242
|
-
fetchPipeline:
|
|
243
|
-
createPipeline:
|
|
244
|
-
updatePipeline:
|
|
245
|
-
deletePipeline:
|
|
246
|
-
addStage:
|
|
247
|
-
updateStage:
|
|
248
|
-
removeStage:
|
|
249
|
-
reorderStages:
|
|
250
|
-
testPipeline:
|
|
251
|
-
executePipeline:
|
|
252
|
-
getExecution:
|
|
253
|
-
listExecutions:
|
|
254
|
-
refetch:
|
|
240
|
+
loading: y,
|
|
241
|
+
error: x,
|
|
242
|
+
pipelines: F,
|
|
243
|
+
fetchPipelines: I,
|
|
244
|
+
fetchPipeline: L,
|
|
245
|
+
createPipeline: R,
|
|
246
|
+
updatePipeline: z,
|
|
247
|
+
deletePipeline: B,
|
|
248
|
+
addStage: V,
|
|
249
|
+
updateStage: H,
|
|
250
|
+
removeStage: U,
|
|
251
|
+
reorderStages: W,
|
|
252
|
+
testPipeline: G,
|
|
253
|
+
executePipeline: K,
|
|
254
|
+
getExecution: q,
|
|
255
|
+
listExecutions: J,
|
|
256
|
+
refetch: Y
|
|
255
257
|
};
|
|
256
258
|
}
|
|
257
259
|
//#endregion
|
|
258
|
-
export {
|
|
260
|
+
export { g as default };
|
|
259
261
|
|
|
260
262
|
//# sourceMappingURL=usePipelineOperations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePipelineOperations.js","names":[],"sources":["../../../src/bigconsole/hooks/usePipelineOperations.ts"],"sourcesContent":["/**\n * Pipeline Operations Hook\n *\n * Custom hook for Pipeline CRUD operations with Apollo Client.\n * Integrates with the Pipeline Zustand store for state management.\n */\n\nimport { useState, useMemo, useCallback, useEffect } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { usePipelineStore } from '../store/pipelineStore';\nimport {\n ListPipelinesDocument,\n GetPipelineDocument,\n CreatePipelineDocument,\n UpdatePipelineDocument,\n DeletePipelineDocument,\n TestPipelineDocument,\n ExecutePipelineDocument,\n GetPipelineExecutionDocument,\n ListPipelineExecutionsDocument,\n} from '../../generated/wspace-operations';\nimport type {\n Pipeline,\n PipelineStage,\n PipelineStatus,\n PipelineExecution,\n StageErrorHandling,\n ParserType,\n} from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\ninterface UsePipelineOperationsOptions {\n consoleId?: string;\n skipFetch?: boolean;\n}\n\ninterface PipelineFilters {\n status?: PipelineStatus;\n}\n\ninterface CreatePipelineInput {\n consoleId: string;\n name: string;\n description?: string;\n status?: PipelineStatus;\n stages?: CreatePipelineStageInput[];\n metadata?: Record<string, unknown>;\n}\n\ninterface UpdatePipelineInput {\n name?: string;\n description?: string;\n status?: PipelineStatus;\n metadata?: Record<string, unknown>;\n}\n\ninterface CreatePipelineStageInput {\n parserId: string;\n parserName?: string;\n parserType?: ParserType;\n expression?: string;\n inputKey?: string;\n outputKey?: string;\n enabled?: boolean;\n onError?: StageErrorHandling;\n fallbackValue?: unknown;\n description?: string;\n}\n\ninterface UpdatePipelineStageInput {\n parserId?: string;\n parserName?: string;\n parserType?: ParserType;\n expression?: string;\n inputKey?: string;\n outputKey?: string;\n enabled?: boolean;\n onError?: StageErrorHandling;\n fallbackValue?: unknown;\n description?: string;\n}\n\ninterface TestPipelineInput {\n pipelineId: string;\n inputData: string; // JSON string\n}\n\ninterface ExecutePipelineInput {\n pipelineId: string;\n inputData?: string; // JSON string\n}\n\n// ============================================================================\n// GRAPHQL RESULT TYPES\n// ============================================================================\n\ninterface ListPipelinesResult {\n listPipelines?: {\n edges: Array<{ node: Pipeline; cursor: string }>;\n pageInfo?: { hasNextPage: boolean; endCursor?: string };\n totalCount?: number;\n };\n}\n\ninterface GetPipelineResult {\n pipeline?: Pipeline;\n}\n\ninterface CreatePipelineResult {\n createPipeline?: Pipeline;\n}\n\ninterface UpdatePipelineResult {\n updatePipeline?: Pipeline;\n}\n\ninterface DeletePipelineResult {\n deletePipeline?: boolean;\n}\n\ninterface AddPipelineStageResult {\n addPipelineStage?: Pipeline;\n}\n\ninterface UpdatePipelineStageResult {\n updatePipelineStage?: PipelineStage;\n}\n\ninterface RemovePipelineStageResult {\n removePipelineStage?: { id: string };\n}\n\ninterface ReorderPipelineStagesResult {\n reorderPipelineStages?: Pipeline;\n}\n\ninterface TestPipelineResult {\n testPipeline?: PipelineExecution;\n}\n\ninterface ExecutePipelineResult {\n executePipeline?: PipelineExecution;\n}\n\ninterface GetPipelineExecutionResult {\n pipelineExecution?: PipelineExecution;\n}\n\ninterface ListPipelineExecutionsResult {\n listPipelineExecutions?: PipelineExecution[];\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function usePipelineOperations(options: UsePipelineOperationsOptions = {}) {\n const { consoleId, skipFetch = false } = options;\n\n // Local state\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n // Apollo client\n const client = useApolloClient();\n\n // Store selectors and actions\n const pipelinesMap = usePipelineStore((state) => state.pipelines);\n const setPipelines = usePipelineStore((state) => state.setPipelines);\n const addPipeline = usePipelineStore((state) => state.addPipeline);\n const updatePipelineInStore = usePipelineStore((state) => state.updatePipeline);\n const removePipeline = usePipelineStore((state) => state.removePipeline);\n const updateStageInStore = usePipelineStore((state) => state.updateStage);\n const removeStageFromStore = usePipelineStore((state) => state.removeStage);\n const setPipelineTesting = usePipelineStore((state) => state.setPipelineTesting);\n const setTestExecution = usePipelineStore((state) => state.setTestExecution);\n const setIsTestRunning = usePipelineStore((state) => state.setIsTestRunning);\n\n // Memoized array of pipelines\n const pipelines = useMemo(() => Array.from(pipelinesMap.values()), [pipelinesMap]);\n\n // ============================================================================\n // OPERATIONS\n // ============================================================================\n\n /**\n * Fetch all pipelines with optional filters\n */\n const fetchPipelines = useCallback(\n async (filters?: PipelineFilters): Promise<Pipeline[]> => {\n if (!consoleId) {\n return [];\n }\n\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<ListPipelinesResult>({\n query: ListPipelinesDocument,\n variables: {\n consoleId,\n status: filters?.status,\n first: 100,\n },\n fetchPolicy: 'network-only',\n });\n\n const edges = result.data?.listPipelines?.edges || [];\n const normalized = edges.map((edge: { node: Pipeline }) => edge.node);\n\n setPipelines(normalized);\n return normalized;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to fetch pipelines');\n setError(error);\n return [];\n } finally {\n setLoading(false);\n }\n },\n [client, consoleId, setPipelines]\n );\n\n /**\n * Fetch a single pipeline by ID\n */\n const fetchPipeline = useCallback(\n async (id: string): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<GetPipelineResult>({\n query: GetPipelineDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n const pipeline = result.data?.pipeline;\n if (pipeline) {\n addPipeline(pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to fetch pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, addPipeline]\n );\n\n /**\n * Create a new pipeline\n */\n const createPipeline = useCallback(\n async (input: CreatePipelineInput): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<CreatePipelineResult>({\n mutation: CreatePipelineDocument,\n variables: { input },\n });\n\n const pipeline = result.data?.createPipeline;\n if (pipeline) {\n addPipeline(pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to create pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, addPipeline]\n );\n\n /**\n * Update an existing pipeline\n */\n const updatePipeline = useCallback(\n async (id: string, input: UpdatePipelineInput, version: number): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<UpdatePipelineResult>({\n mutation: UpdatePipelineDocument,\n variables: { id, input, version },\n });\n\n const pipeline = result.data?.updatePipeline;\n if (pipeline) {\n updatePipelineInStore(id, pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to update pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, updatePipelineInStore]\n );\n\n /**\n * Delete a pipeline\n */\n const deletePipeline = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n setLoading(true);\n setError(null);\n\n await client.mutate<DeletePipelineResult>({\n mutation: DeletePipelineDocument,\n variables: { id },\n });\n\n removePipeline(id);\n return true;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to delete pipeline');\n setError(error);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [client, removePipeline]\n );\n\n /**\n * Add a stage to a pipeline\n */\n const addStage = useCallback(\n async (pipelineId: string, input: CreatePipelineStageInput, version: number): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<AddPipelineStageResult>({\n mutation: CreatePipelineDocument, // Note: addStage is not available in schema, using create pipeline\n variables: { pipelineId, input, version },\n });\n\n const pipeline = result.data?.addPipelineStage;\n if (pipeline) {\n updatePipelineInStore(pipelineId, pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to add stage');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, updatePipelineInStore]\n );\n\n /**\n * Update a pipeline stage\n */\n const updateStage = useCallback(\n async (stageId: string, input: UpdatePipelineStageInput, version: number): Promise<PipelineStage | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<UpdatePipelineStageResult>({\n mutation: UpdatePipelineDocument, // Note: updateStage is not available in schema, using update pipeline\n variables: { stageId, input, version },\n });\n\n const stage = result.data?.updatePipelineStage;\n if (stage) {\n // Find pipeline containing this stage and update\n const pipeline = Array.from(pipelinesMap.values()).find((p) => p.stages?.some((s) => s.id === stageId));\n if (pipeline) {\n const stageIndex = pipeline.stages?.findIndex((s) => s.id === stageId);\n if (stageIndex !== undefined && stageIndex >= 0) {\n updateStageInStore(pipeline.id, stageIndex, stage);\n }\n }\n return stage;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to update stage');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, pipelinesMap, updateStageInStore]\n );\n\n /**\n * Remove a stage from a pipeline\n */\n const removeStage = useCallback(\n async (stageId: string, version: number): Promise<boolean> => {\n try {\n setLoading(true);\n setError(null);\n\n await client.mutate<RemovePipelineStageResult>({\n mutation: DeletePipelineDocument, // Note: removeStage is not available in schema\n variables: { stageId, version },\n });\n\n // Find pipeline containing this stage and remove\n const pipeline = Array.from(pipelinesMap.values()).find((p) => p.stages?.some((s) => s.id === stageId));\n if (pipeline) {\n const stageIndex = pipeline.stages?.findIndex((s) => s.id === stageId);\n if (stageIndex !== undefined && stageIndex >= 0) {\n removeStageFromStore(pipeline.id, stageIndex);\n }\n }\n\n return true;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to remove stage');\n setError(error);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [client, pipelinesMap, removeStageFromStore]\n );\n\n /**\n * Reorder stages in a pipeline\n */\n const reorderStages = useCallback(\n async (pipelineId: string, stageIds: string[], version: number): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<ReorderPipelineStagesResult>({\n mutation: UpdatePipelineDocument, // Note: reorderStages is not available in schema\n variables: { pipelineId, stageIds, version },\n });\n\n const pipeline = result.data?.reorderPipelineStages;\n if (pipeline) {\n updatePipelineInStore(pipelineId, pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to reorder stages');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, updatePipelineInStore]\n );\n\n /**\n * Test a pipeline with sample input (dry run)\n */\n const testPipeline = useCallback(\n async (input: TestPipelineInput): Promise<PipelineExecution | null> => {\n try {\n setLoading(true);\n setError(null);\n setIsTestRunning(true);\n setPipelineTesting(input.pipelineId, true);\n\n const result = await client.mutate<TestPipelineResult>({\n mutation: TestPipelineDocument,\n variables: { input },\n });\n\n const execution = result.data?.testPipeline;\n if (execution) {\n setTestExecution(execution);\n return execution;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to test pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n setIsTestRunning(false);\n setPipelineTesting(input.pipelineId, false);\n }\n },\n [client, setIsTestRunning, setPipelineTesting, setTestExecution]\n );\n\n /**\n * Execute a pipeline for real\n */\n const executePipeline = useCallback(\n async (input: ExecutePipelineInput): Promise<PipelineExecution | null> => {\n try {\n setLoading(true);\n setError(null);\n setPipelineTesting(input.pipelineId, true);\n\n const result = await client.mutate<ExecutePipelineResult>({\n mutation: ExecutePipelineDocument,\n variables: { input },\n });\n\n const execution = result.data?.executePipeline;\n if (execution) {\n return execution;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to execute pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n setPipelineTesting(input.pipelineId, false);\n }\n },\n [client, setPipelineTesting]\n );\n\n /**\n * Get a specific pipeline execution by ID\n */\n const getExecution = useCallback(\n async (id: string): Promise<PipelineExecution | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<GetPipelineExecutionResult>({\n query: GetPipelineExecutionDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n return result.data?.pipelineExecution || null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to get execution');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n /**\n * List executions for a pipeline\n */\n const listExecutions = useCallback(\n async (pipelineId: string): Promise<PipelineExecution[]> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<ListPipelineExecutionsResult>({\n query: ListPipelineExecutionsDocument,\n variables: { pipelineId, first: 50 },\n fetchPolicy: 'network-only',\n });\n\n return result.data?.listPipelineExecutions || [];\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to list executions');\n setError(error);\n return [];\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n /**\n * Refetch all pipelines\n */\n const refetch = useCallback(async () => {\n await fetchPipelines();\n }, [fetchPipelines]);\n\n // Auto-fetch on mount if not skipped\n useEffect(() => {\n if (consoleId && !skipFetch) {\n fetchPipelines();\n }\n }, [consoleId, skipFetch, fetchPipelines]);\n\n return {\n loading,\n error,\n pipelines,\n fetchPipelines,\n fetchPipeline,\n createPipeline,\n updatePipeline,\n deletePipeline,\n addStage,\n updateStage,\n removeStage,\n reorderStages,\n testPipeline,\n executePipeline,\n getExecution,\n listExecutions,\n refetch,\n };\n}\n\nexport default usePipelineOperations;\n"],"mappings":";;;;;AA+JA,SAAgB,EAAsB,IAAwC,EAAE,EAAE;CAChF,IAAM,EAAE,cAAW,eAAY,OAAU,GAGnC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAO,KAAY,EAAuB,KAAK,EAGhD,IAAS,GAAiB,EAG1B,IAAe,GAAkB,MAAU,EAAM,UAAU,EAC3D,IAAe,GAAkB,MAAU,EAAM,aAAa,EAC9D,IAAc,GAAkB,MAAU,EAAM,YAAY,EAC5D,IAAwB,GAAkB,MAAU,EAAM,eAAe,EACzE,IAAiB,GAAkB,MAAU,EAAM,eAAe,EAClE,IAAqB,GAAkB,MAAU,EAAM,YAAY,EACnE,IAAuB,GAAkB,MAAU,EAAM,YAAY,EACrE,IAAqB,GAAkB,MAAU,EAAM,mBAAmB,EAC1E,IAAmB,GAAkB,MAAU,EAAM,iBAAiB,EACtE,IAAmB,GAAkB,MAAU,EAAM,iBAAiB,EAGtE,IAAY,QAAc,MAAM,KAAK,EAAa,QAAQ,CAAC,EAAE,CAAC,EAAa,CAAC,EAS5E,IAAiB,EACrB,OAAO,MAAmD;AACxD,MAAI,CAAC,EACH,QAAO,EAAE;AAGX,MAAI;AAEF,GADA,EAAW,GAAK,EAChB,EAAS,KAAK;GAad,IAAM,MAXS,MAAM,EAAO,MAA2B;IACrD,OAAO;IACP,WAAW;KACT;KACA,QAAQ,GAAS;KACjB,OAAO;KACR;IACD,aAAa;IACd,CAAC,EAEmB,MAAM,eAAe,SAAS,EAAE,EAC5B,KAAK,MAA6B,EAAK,KAAK;AAGrE,UADA,EAAa,EAAW,EACjB;WACA,GAAK;AAGZ,UADA,EADc,aAAe,QAAQ,IAAM,gBAAI,MAAM,4BAA4B,CAClE,EACR,EAAE;YACD;AACR,KAAW,GAAM;;IAGrB;EAAC;EAAQ;EAAW;EAAa,CAClC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,IAAM,gBAAI,MAAM,4BAA4B,CAClE,EACR,EAAE;YACD;AACR,KAAW,GAAM;;IAGrB,CAAC,EAAO,CACT,EAKK,IAAU,EAAY,YAAY;AACtC,QAAM,GAAgB;IACrB,CAAC,EAAe,CAAC;AASpB,QANA,QAAgB;AACd,EAAI,KAAa,CAAC,KAChB,GAAgB;IAEjB;EAAC;EAAW;EAAW;EAAe,CAAC,EAEnC;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"usePipelineOperations.js","names":[],"sources":["../../../src/bigconsole/hooks/usePipelineOperations.ts"],"sourcesContent":["/**\n * Pipeline Operations Hook\n *\n * Custom hook for Pipeline CRUD operations with Apollo Client.\n * Integrates with the Pipeline Zustand store for state management.\n */\n\nimport { useState, useMemo, useCallback, useEffect, useRef } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { usePipelineStore } from '../store/pipelineStore';\nimport {\n ListPipelinesDocument,\n GetPipelineDocument,\n CreatePipelineDocument,\n UpdatePipelineDocument,\n DeletePipelineDocument,\n TestPipelineDocument,\n ExecutePipelineDocument,\n GetPipelineExecutionDocument,\n ListPipelineExecutionsDocument,\n} from '../../generated/wspace-operations';\nimport type {\n Pipeline,\n PipelineStage,\n PipelineStatus,\n PipelineExecution,\n StageErrorHandling,\n ParserType,\n} from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\ninterface UsePipelineOperationsOptions {\n consoleId?: string;\n skipFetch?: boolean;\n}\n\ninterface PipelineFilters {\n status?: PipelineStatus;\n}\n\ninterface CreatePipelineInput {\n consoleId: string;\n name: string;\n description?: string;\n status?: PipelineStatus;\n stages?: CreatePipelineStageInput[];\n metadata?: Record<string, unknown>;\n}\n\ninterface UpdatePipelineInput {\n name?: string;\n description?: string;\n status?: PipelineStatus;\n metadata?: Record<string, unknown>;\n}\n\ninterface CreatePipelineStageInput {\n parserId: string;\n parserName?: string;\n parserType?: ParserType;\n expression?: string;\n inputKey?: string;\n outputKey?: string;\n enabled?: boolean;\n onError?: StageErrorHandling;\n fallbackValue?: unknown;\n description?: string;\n}\n\ninterface UpdatePipelineStageInput {\n parserId?: string;\n parserName?: string;\n parserType?: ParserType;\n expression?: string;\n inputKey?: string;\n outputKey?: string;\n enabled?: boolean;\n onError?: StageErrorHandling;\n fallbackValue?: unknown;\n description?: string;\n}\n\ninterface TestPipelineInput {\n pipelineId: string;\n inputData: string; // JSON string\n}\n\ninterface ExecutePipelineInput {\n pipelineId: string;\n inputData?: string; // JSON string\n}\n\n// ============================================================================\n// GRAPHQL RESULT TYPES\n// ============================================================================\n\ninterface ListPipelinesResult {\n listPipelines?: {\n edges: Array<{ node: Pipeline; cursor: string }>;\n pageInfo?: { hasNextPage: boolean; endCursor?: string };\n totalCount?: number;\n };\n}\n\ninterface GetPipelineResult {\n pipeline?: Pipeline;\n}\n\ninterface CreatePipelineResult {\n createPipeline?: Pipeline;\n}\n\ninterface UpdatePipelineResult {\n updatePipeline?: Pipeline;\n}\n\ninterface DeletePipelineResult {\n deletePipeline?: boolean;\n}\n\ninterface AddPipelineStageResult {\n addPipelineStage?: Pipeline;\n}\n\ninterface UpdatePipelineStageResult {\n updatePipelineStage?: PipelineStage;\n}\n\ninterface RemovePipelineStageResult {\n removePipelineStage?: { id: string };\n}\n\ninterface ReorderPipelineStagesResult {\n reorderPipelineStages?: Pipeline;\n}\n\ninterface TestPipelineResult {\n testPipeline?: PipelineExecution;\n}\n\ninterface ExecutePipelineResult {\n executePipeline?: PipelineExecution;\n}\n\ninterface GetPipelineExecutionResult {\n pipelineExecution?: PipelineExecution;\n}\n\ninterface ListPipelineExecutionsResult {\n listPipelineExecutions?: PipelineExecution[];\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function usePipelineOperations(options: UsePipelineOperationsOptions = {}) {\n const { consoleId, skipFetch = false } = options;\n\n // Local state\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n // Apollo client\n const client = useApolloClient();\n\n // Store selectors and actions\n const pipelinesMap = usePipelineStore((state) => state.pipelines);\n const setPipelines = usePipelineStore((state) => state.setPipelines);\n const addPipeline = usePipelineStore((state) => state.addPipeline);\n const updatePipelineInStore = usePipelineStore((state) => state.updatePipeline);\n const removePipeline = usePipelineStore((state) => state.removePipeline);\n const updateStageInStore = usePipelineStore((state) => state.updateStage);\n const removeStageFromStore = usePipelineStore((state) => state.removeStage);\n const setPipelineTesting = usePipelineStore((state) => state.setPipelineTesting);\n const setTestExecution = usePipelineStore((state) => state.setTestExecution);\n const setIsTestRunning = usePipelineStore((state) => state.setIsTestRunning);\n\n const listRequest = useRef(0);\n // A scope change must never show records belonging to the previous console.\n const pipelines = useMemo(\n () => Array.from(pipelinesMap.values()).filter((pipeline) => !consoleId || pipeline.consoleId === consoleId),\n [pipelinesMap, consoleId]\n );\n\n // ============================================================================\n // OPERATIONS\n // ============================================================================\n\n /**\n * Fetch all pipelines with optional filters\n */\n const fetchPipelines = useCallback(\n async (filters?: PipelineFilters): Promise<Pipeline[]> => {\n if (!consoleId) {\n return [];\n }\n\n const request = ++listRequest.current;\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<ListPipelinesResult>({\n query: ListPipelinesDocument,\n variables: {\n consoleId,\n status: filters?.status,\n first: 100,\n },\n fetchPolicy: 'network-only',\n });\n\n const edges = result.data?.listPipelines?.edges || [];\n const normalized = edges.map((edge: { node: Pipeline }) => edge.node);\n\n if (request !== listRequest.current) return [];\n setPipelines(normalized);\n return normalized;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to fetch pipelines');\n if (request === listRequest.current) setError(error);\n return [];\n } finally {\n if (request === listRequest.current) setLoading(false);\n }\n },\n [client, consoleId, setPipelines]\n );\n\n /**\n * Fetch a single pipeline by ID\n */\n const fetchPipeline = useCallback(\n async (id: string): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<GetPipelineResult>({\n query: GetPipelineDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n const pipeline = result.data?.pipeline;\n if (pipeline) {\n addPipeline(pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to fetch pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, addPipeline]\n );\n\n /**\n * Create a new pipeline\n */\n const createPipeline = useCallback(\n async (input: CreatePipelineInput): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<CreatePipelineResult>({\n mutation: CreatePipelineDocument,\n variables: { input },\n });\n\n const pipeline = result.data?.createPipeline;\n if (pipeline) {\n addPipeline(pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to create pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, addPipeline]\n );\n\n /**\n * Update an existing pipeline\n */\n const updatePipeline = useCallback(\n async (id: string, input: UpdatePipelineInput, version: number): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<UpdatePipelineResult>({\n mutation: UpdatePipelineDocument,\n variables: { id, input, version },\n });\n\n const pipeline = result.data?.updatePipeline;\n if (pipeline) {\n updatePipelineInStore(id, pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to update pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, updatePipelineInStore]\n );\n\n /**\n * Delete a pipeline\n */\n const deletePipeline = useCallback(\n async (id: string): Promise<boolean> => {\n try {\n setLoading(true);\n setError(null);\n\n await client.mutate<DeletePipelineResult>({\n mutation: DeletePipelineDocument,\n variables: { id },\n });\n\n removePipeline(id);\n return true;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to delete pipeline');\n setError(error);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [client, removePipeline]\n );\n\n /**\n * Add a stage to a pipeline\n */\n const addStage = useCallback(\n async (pipelineId: string, input: CreatePipelineStageInput, version: number): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<AddPipelineStageResult>({\n mutation: CreatePipelineDocument, // Note: addStage is not available in schema, using create pipeline\n variables: { pipelineId, input, version },\n });\n\n const pipeline = result.data?.addPipelineStage;\n if (pipeline) {\n updatePipelineInStore(pipelineId, pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to add stage');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, updatePipelineInStore]\n );\n\n /**\n * Update a pipeline stage\n */\n const updateStage = useCallback(\n async (stageId: string, input: UpdatePipelineStageInput, version: number): Promise<PipelineStage | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<UpdatePipelineStageResult>({\n mutation: UpdatePipelineDocument, // Note: updateStage is not available in schema, using update pipeline\n variables: { stageId, input, version },\n });\n\n const stage = result.data?.updatePipelineStage;\n if (stage) {\n // Find pipeline containing this stage and update\n const pipeline = Array.from(pipelinesMap.values()).find((p) => p.stages?.some((s) => s.id === stageId));\n if (pipeline) {\n const stageIndex = pipeline.stages?.findIndex((s) => s.id === stageId);\n if (stageIndex !== undefined && stageIndex >= 0) {\n updateStageInStore(pipeline.id, stageIndex, stage);\n }\n }\n return stage;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to update stage');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, pipelinesMap, updateStageInStore]\n );\n\n /**\n * Remove a stage from a pipeline\n */\n const removeStage = useCallback(\n async (stageId: string, version: number): Promise<boolean> => {\n try {\n setLoading(true);\n setError(null);\n\n await client.mutate<RemovePipelineStageResult>({\n mutation: DeletePipelineDocument, // Note: removeStage is not available in schema\n variables: { stageId, version },\n });\n\n // Find pipeline containing this stage and remove\n const pipeline = Array.from(pipelinesMap.values()).find((p) => p.stages?.some((s) => s.id === stageId));\n if (pipeline) {\n const stageIndex = pipeline.stages?.findIndex((s) => s.id === stageId);\n if (stageIndex !== undefined && stageIndex >= 0) {\n removeStageFromStore(pipeline.id, stageIndex);\n }\n }\n\n return true;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to remove stage');\n setError(error);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [client, pipelinesMap, removeStageFromStore]\n );\n\n /**\n * Reorder stages in a pipeline\n */\n const reorderStages = useCallback(\n async (pipelineId: string, stageIds: string[], version: number): Promise<Pipeline | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.mutate<ReorderPipelineStagesResult>({\n mutation: UpdatePipelineDocument, // Note: reorderStages is not available in schema\n variables: { pipelineId, stageIds, version },\n });\n\n const pipeline = result.data?.reorderPipelineStages;\n if (pipeline) {\n updatePipelineInStore(pipelineId, pipeline);\n return pipeline;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to reorder stages');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client, updatePipelineInStore]\n );\n\n /**\n * Test a pipeline with sample input (dry run)\n */\n const testPipeline = useCallback(\n async (input: TestPipelineInput): Promise<PipelineExecution | null> => {\n try {\n setLoading(true);\n setError(null);\n setIsTestRunning(true);\n setPipelineTesting(input.pipelineId, true);\n\n const result = await client.mutate<TestPipelineResult>({\n mutation: TestPipelineDocument,\n variables: { input },\n });\n\n const execution = result.data?.testPipeline;\n if (execution) {\n setTestExecution(execution);\n return execution;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to test pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n setIsTestRunning(false);\n setPipelineTesting(input.pipelineId, false);\n }\n },\n [client, setIsTestRunning, setPipelineTesting, setTestExecution]\n );\n\n /**\n * Execute a pipeline for real\n */\n const executePipeline = useCallback(\n async (input: ExecutePipelineInput): Promise<PipelineExecution | null> => {\n try {\n setLoading(true);\n setError(null);\n setPipelineTesting(input.pipelineId, true);\n\n const result = await client.mutate<ExecutePipelineResult>({\n mutation: ExecutePipelineDocument,\n variables: { input },\n });\n\n const execution = result.data?.executePipeline;\n if (execution) {\n return execution;\n }\n\n return null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to execute pipeline');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n setPipelineTesting(input.pipelineId, false);\n }\n },\n [client, setPipelineTesting]\n );\n\n /**\n * Get a specific pipeline execution by ID\n */\n const getExecution = useCallback(\n async (id: string): Promise<PipelineExecution | null> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<GetPipelineExecutionResult>({\n query: GetPipelineExecutionDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n return result.data?.pipelineExecution || null;\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to get execution');\n setError(error);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n /**\n * List executions for a pipeline\n */\n const listExecutions = useCallback(\n async (pipelineId: string): Promise<PipelineExecution[]> => {\n try {\n setLoading(true);\n setError(null);\n\n const result = await client.query<ListPipelineExecutionsResult>({\n query: ListPipelineExecutionsDocument,\n variables: { pipelineId, first: 50 },\n fetchPolicy: 'network-only',\n });\n\n return result.data?.listPipelineExecutions || [];\n } catch (err) {\n const error = err instanceof Error ? err : new Error('Failed to list executions');\n setError(error);\n return [];\n } finally {\n setLoading(false);\n }\n },\n [client]\n );\n\n /**\n * Refetch all pipelines\n */\n const refetch = useCallback(async () => {\n await fetchPipelines();\n }, [fetchPipelines]);\n\n // Auto-fetch on mount if not skipped\n useEffect(() => {\n if (consoleId && !skipFetch) {\n fetchPipelines();\n }\n }, [consoleId, skipFetch, fetchPipelines]);\n\n return {\n loading,\n error,\n pipelines,\n fetchPipelines,\n fetchPipeline,\n createPipeline,\n updatePipeline,\n deletePipeline,\n addStage,\n updateStage,\n removeStage,\n reorderStages,\n testPipeline,\n executePipeline,\n get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AAK,GAEC,MAAM,EAAO,MAAoC;IAC9D,OAAO;IACP,WAAW;KAAE;KAAY,OAAO;KAAI;IACpC,aAAa;IACd,CAAC,EAEY,MAAM,0BAA0B,EAAE;WACzC,GAAK;AAGZ,UADA,EADc,aAAe,QAAQ,IAAM,gBAAI,MAAM,4BAA4B,CAClE,EACR,EAAE;YACD;AACR,KAAW,GAAM;;IAGrB,CAAC,EAAO,CACT,EAKK,IAAU,EAAY,YAAY;AACtC,QAAM,GAAgB;IACrB,CAAC,EAAe,CAAC;AASpB,QANA,QAAgB;AACd,EAAI,KAAa,CAAC,KAChB,GAAgB;IAEjB;EAAC;EAAW;EAAW;EAAe,CAAC,EAEnC;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ShareRecipientType } from './useDashboardSharing';
|
|
2
|
+
|
|
3
|
+
export interface ShareRecipient {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
type: ShareRecipientType;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
}
|
|
10
|
+
/** Discover only members/groups of the selected workspace; never use a global user directory. */
|
|
11
|
+
export declare function useShareRecipients(enabled: boolean, search: string): {
|
|
12
|
+
results: ShareRecipient[];
|
|
13
|
+
owner: string;
|
|
14
|
+
workspaceId: string | undefined;
|
|
15
|
+
loading: boolean;
|
|
16
|
+
error: boolean;
|
|
17
|
+
hasMoreMembers: boolean;
|
|
18
|
+
hasMoreGroups: boolean;
|
|
19
|
+
loadMoreMembers: () => void;
|
|
20
|
+
retry: () => void;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useShareRecipients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShareRecipients.d.ts","sourceRoot":"","sources":["../../../src/bigconsole/hooks/useShareRecipients.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAOhE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,kBAAkB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAUD,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;EAsLlE"}
|