diff --git a/examples/using-database-plugin.ts b/examples/using-database-plugin.ts deleted file mode 100644 index 65699ae..0000000 --- a/examples/using-database-plugin.ts +++ /dev/null @@ -1,36 +0,0 @@ -// import "@flyde/blocks/plugins/PluginRegistration"; // This line registers the DatabaseBlock - -// const workflowConfig = { -// // ... your workflow configuration -// }; - -// const environment = { -// // ... your environment configuration -// }; - -// const connections = [ -// // ... your connections -// ]; - -// const variableResolver = new VariableResolver(); - -// const engine = new ExecutionEngine( -// workflowConfig, -// environment, -// variableResolver, -// connections, -// ); - -// const blockConfigs = [ -// { -// id: "db1", -// type: "database", -// inputs: { query: "SELECT * FROM users" }, -// // ... other block configuration -// }, -// // ... other block configurations -// ]; - -// engine.executeWorkflow(blockConfigs).then(() => { -// console.log("Workflow execution completed"); -// }); diff --git a/examples/workflow.json b/examples/workflow.json deleted file mode 100644 index 6fbea2a..0000000 --- a/examples/workflow.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "id": "example-workflow", - "blocks": [ - { - "id": "Start", - "type": "blocks/start@0.1", - "inputs": {}, - "outputs": { "next": "Input" } - }, - { - "id": "Input", - "type": "blocks/input@0.1", - "inputs": { "startInput": "Start" }, - "params": { "value": "some text" }, - "outputs": { "inputValue": "Logic" }, - "onError": "ErrorBlock" - }, - { - "id": "Logic", - "type": "blocks/logic@0.1", - "inputs": { "inputValue": "Input" }, - "params": { "condition": "input == 'Yes'" }, - "outputs": { "true": "SuccessBlock", "false": "FailureBlock" }, - "onError": "ErrorBlock" - }, - { - "id": "SuccessBlock", - "type": "blocks/output@0.1", - "inputs": { "logicOutput": "Logic" }, - "params": { "message": "Condition met! Output success message." }, - "outputs": { "next": "End" } - }, - { - "id": "FailureBlock", - "type": "blocks/output@0.1", - "inputs": { "logicOutput": "Logic" }, - "params": { "message": "Condition not met! Output failure message." }, - "outputs": { "next": "End" } - }, - { - "id": "End", - "type": "blocks/end@0.1", - "inputs": { "previous": ["SuccessBlock", "FailureBlock"] } - }, - { - "id": "ErrorBlock", - "type": "blocks/errorBlock@0.1", - "inputs": { "errorSource": ["Input", "Logic"] }, - "params": { "message": "An error occurred!" } - } - ], - "connections": [ - { "from": "Start", "to": "Input" }, - { "from": "Input", "to": "Logic" }, - { "from": "Logic", "to": "SuccessBlock", "output": "true" }, - { "from": "Logic", "to": "FailureBlock", "output": "false" }, - { "from": "Logic", "to": "ErrorBlock", "onError": true }, - { "from": "SuccessBlock", "to": "End" }, - { "from": "FailureBlock", "to": "End" } - ], - "config": { - "maxConcurrentTasks": 1, - "executionContext": "browser", - "supportsWebSocket": false, - "retryOnFailure": false - } -} diff --git a/packages/execution-engine/src/ExecutionEngine.ts b/packages/execution-engine/src/ExecutionEngine.ts index 7d76952..570cebf 100644 --- a/packages/execution-engine/src/ExecutionEngine.ts +++ b/packages/execution-engine/src/ExecutionEngine.ts @@ -11,7 +11,6 @@ import { IExecutionResult } from "@data-river/shared/interfaces/IExecutionResult import { VariableResolver } from "./VariableResolver"; import { IExecutionStrategy } from "./strategies/IExecutionStrategy"; import { ILogger } from "@data-river/shared/interfaces/ILogger"; -import { forEach } from "lodash"; @injectable() export class ExecutionEngine { @@ -244,6 +243,8 @@ export class ExecutionEngine { ): { errors: Error[]; } { + this.logger.error(`Error in block ${blockConfig.id}:`, error); + if (blockConfig.onError) { try { blockConfig.onError(error, blockConfig); @@ -255,7 +256,6 @@ export class ExecutionEngine { return { errors: [error as Error] }; } } - this.logger.error(`Error in block ${blockConfig.id}:`, error); return { errors: [error] }; } diff --git a/packages/shared/src/utils/logger/index.ts b/packages/shared/src/utils/logger/index.ts index f82cdfc..a93626d 100644 --- a/packages/shared/src/utils/logger/index.ts +++ b/packages/shared/src/utils/logger/index.ts @@ -35,7 +35,7 @@ export default class DefaultLogger implements ILogger { group(message: string): void { if (this.shouldLog("info")) { - console.group(chalk.bold(message)); // Using console.group for grouping + console.group(chalk.bold(message)); } }