@pipelab/core-node 1.0.1-beta.26 → 1.0.1-beta.27

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @pipelab/core-node
2
2
 
3
+ ## 1.0.1-beta.27
4
+
5
+ ### Patch Changes
6
+
7
+ - sd
8
+ - Updated dependencies
9
+ - @pipelab/constants@1.0.1-beta.23
10
+ - @pipelab/shared@2.0.1-beta.24
11
+
3
12
  ## 1.0.1-beta.26
4
13
 
5
14
  ### Patch Changes
package/dist/index.mjs CHANGED
@@ -1226,6 +1226,39 @@ const registerHistoryHandlers = (context) => {
1226
1226
  });
1227
1227
  }
1228
1228
  });
1229
+ handle("build-history:clear-by-pipeline", async (event, { send, value }) => {
1230
+ try {
1231
+ await checkBuildHistoryAuthorization(event);
1232
+ await buildHistoryStorage.clearByPipeline(value.pipelineId);
1233
+ send({
1234
+ type: "end",
1235
+ data: {
1236
+ type: "success",
1237
+ result: { result: "ok" }
1238
+ }
1239
+ });
1240
+ } catch (error) {
1241
+ logger().error(`Failed to clear build history for pipeline ${value.pipelineId}:`, error);
1242
+ if (error instanceof SubscriptionRequiredError) {
1243
+ send({
1244
+ type: "end",
1245
+ data: {
1246
+ type: "error",
1247
+ ipcError: error.userMessage,
1248
+ code: error.code
1249
+ }
1250
+ });
1251
+ return;
1252
+ }
1253
+ send({
1254
+ type: "end",
1255
+ data: {
1256
+ type: "error",
1257
+ ipcError: error instanceof Error ? error.message : "Failed to clear build history for pipeline"
1258
+ }
1259
+ });
1260
+ }
1261
+ });
1229
1262
  handle("build-history:get-storage-info", async (event, { send }) => {
1230
1263
  try {
1231
1264
  await checkBuildHistoryAuthorization(event);
@@ -1733,6 +1766,7 @@ const executeGraphWithHistory = async ({ graph, variables, projectName, projectP
1733
1766
  const logs = [];
1734
1767
  const sandboxPath = await generateTempFolder(cachePath);
1735
1768
  const { logger } = useLogger();
1769
+ let completedSteps = 0;
1736
1770
  const { registerPlugins, plugins: registeredPlugins } = usePlugins();
1737
1771
  const pluginIds = new Set(graph.map((node) => node.origin?.pluginId).filter(Boolean));
1738
1772
  for (const pluginId of pluginIds) if (!registeredPlugins.value.some((p) => p.id === pluginId)) {
@@ -1759,7 +1793,8 @@ const executeGraphWithHistory = async ({ graph, variables, projectName, projectP
1759
1793
  if (node.type === "action") return await handleActionExecute(node.origin.nodeId, node.origin.pluginId, params, mainWindow, async (data) => {
1760
1794
  if (data.type === "log") {
1761
1795
  const logEntry = {
1762
- type: data.type,
1796
+ id: nanoid(),
1797
+ level: "info",
1763
1798
  message: data.data.message,
1764
1799
  timestamp: data.data.time,
1765
1800
  nodeUid: node?.uid
@@ -1773,7 +1808,11 @@ const executeGraphWithHistory = async ({ graph, variables, projectName, projectP
1773
1808
  onNodeEnter: (node) => {
1774
1809
  onNodeEnter?.(node);
1775
1810
  },
1776
- onNodeExit: (node) => {
1811
+ onNodeExit: async (node) => {
1812
+ completedSteps++;
1813
+ if (!shouldDisableHistory) buildHistoryStorage.update(buildId, { completedSteps }, pipelineId).catch((err) => {
1814
+ logger().error(`Failed to update progress for build ${buildId}:`, err);
1815
+ });
1777
1816
  onNodeExit?.(node);
1778
1817
  },
1779
1818
  abortSignal
@@ -1784,7 +1823,8 @@ const executeGraphWithHistory = async ({ graph, variables, projectName, projectP
1784
1823
  endTime,
1785
1824
  duration: endTime - startTime,
1786
1825
  output: result.steps,
1787
- logs
1826
+ logs,
1827
+ completedSteps
1788
1828
  }, pipelineId);
1789
1829
  return {
1790
1830
  result,
@@ -1802,7 +1842,10 @@ const executeGraphWithHistory = async ({ graph, variables, projectName, projectP
1802
1842
  stack: error instanceof Error ? error.stack : void 0,
1803
1843
  timestamp: endTime
1804
1844
  },
1805
- logs
1845
+ logs,
1846
+ completedSteps,
1847
+ failedSteps: isCanceled ? 0 : 1,
1848
+ cancelledSteps: isCanceled ? 1 : 0
1806
1849
  }, pipelineId);
1807
1850
  throw error;
1808
1851
  } finally {