@solidxai/core 0.1.19-beta.2 → 0.1.19-beta.3

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 (84) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/commands/run-tests.command.d.ts +3 -3
  3. package/dist/commands/run-tests.command.d.ts.map +1 -1
  4. package/dist/commands/run-tests.command.js +5 -5
  5. package/dist/commands/run-tests.command.js.map +1 -1
  6. package/dist/controllers/secret.controller.d.ts +24 -0
  7. package/dist/controllers/secret.controller.d.ts.map +1 -0
  8. package/dist/controllers/{workflow-secret.controller.js → secret.controller.js} +30 -30
  9. package/dist/controllers/secret.controller.js.map +1 -0
  10. package/dist/dtos/{create-workflow-secret.dto.d.ts → create-secret.dto.d.ts} +2 -2
  11. package/dist/dtos/create-secret.dto.d.ts.map +1 -0
  12. package/dist/dtos/{create-workflow-secret.dto.js → create-secret.dto.js} +12 -12
  13. package/dist/dtos/create-secret.dto.js.map +1 -0
  14. package/dist/dtos/{update-workflow-secret.dto.d.ts → update-secret.dto.d.ts} +2 -2
  15. package/dist/dtos/update-secret.dto.d.ts.map +1 -0
  16. package/dist/dtos/{update-workflow-secret.dto.js → update-secret.dto.js} +13 -13
  17. package/dist/dtos/update-secret.dto.js.map +1 -0
  18. package/dist/entities/{workflow-secret.entity.d.ts → secret.entity.d.ts} +2 -2
  19. package/dist/entities/secret.entity.d.ts.map +1 -0
  20. package/dist/entities/{workflow-secret.entity.js → secret.entity.js} +15 -15
  21. package/dist/entities/secret.entity.js.map +1 -0
  22. package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.js +1 -1
  23. package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.js.map +1 -1
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +3 -3
  27. package/dist/index.js.map +1 -1
  28. package/dist/jobs/database/test-run-queue-subscriber-database.service.d.ts +3 -3
  29. package/dist/jobs/database/test-run-queue-subscriber-database.service.d.ts.map +1 -1
  30. package/dist/jobs/database/test-run-queue-subscriber-database.service.js +5 -5
  31. package/dist/jobs/database/test-run-queue-subscriber-database.service.js.map +1 -1
  32. package/dist/repository/{workflow-secret.repository.d.ts → secret.repository.d.ts} +3 -3
  33. package/dist/repository/secret.repository.d.ts.map +1 -0
  34. package/dist/repository/{workflow-secret.repository.js → secret.repository.js} +8 -8
  35. package/dist/repository/secret.repository.js.map +1 -0
  36. package/dist/seeders/seed-data/solid-core-metadata.json +32 -32
  37. package/dist/services/crud.service.d.ts +1 -0
  38. package/dist/services/crud.service.d.ts.map +1 -1
  39. package/dist/services/crud.service.js +13 -1
  40. package/dist/services/crud.service.js.map +1 -1
  41. package/dist/services/draft-publish-helper.service.d.ts.map +1 -1
  42. package/dist/services/draft-publish-helper.service.js +8 -6
  43. package/dist/services/draft-publish-helper.service.js.map +1 -1
  44. package/dist/services/{workflow-secret.service.d.ts → secret.service.d.ts} +11 -11
  45. package/dist/services/secret.service.d.ts.map +1 -0
  46. package/dist/services/{workflow-secret.service.js → secret.service.js} +17 -17
  47. package/dist/services/secret.service.js.map +1 -0
  48. package/dist/services/workflow/workflow-runtime.service.d.ts +3 -3
  49. package/dist/services/workflow/workflow-runtime.service.d.ts.map +1 -1
  50. package/dist/services/workflow/workflow-runtime.service.js +5 -5
  51. package/dist/services/workflow/workflow-runtime.service.js.map +1 -1
  52. package/dist/solid-core.module.js +8 -8
  53. package/dist/solid-core.module.js.map +1 -1
  54. package/package.json +1 -1
  55. package/sql/cleanup-old-workflow-secret-metadata.mssql.sql +57 -0
  56. package/sql/cleanup-old-workflow-secret-metadata.postgres.sql +59 -0
  57. package/src/commands/run-tests.command.ts +3 -3
  58. package/src/controllers/{workflow-secret.controller.ts → secret.controller.ts} +10 -10
  59. package/src/dtos/{create-workflow-secret.dto.ts → create-secret.dto.ts} +1 -1
  60. package/src/dtos/{update-workflow-secret.dto.ts → update-secret.dto.ts} +1 -1
  61. package/src/entities/{workflow-secret.entity.ts → secret.entity.ts} +2 -2
  62. package/src/helpers/field-crud-managers/PasswordFieldCrudManager.ts +1 -1
  63. package/src/index.ts +3 -3
  64. package/src/jobs/database/test-run-queue-subscriber-database.service.ts +3 -3
  65. package/src/repository/{workflow-secret.repository.ts → secret.repository.ts} +3 -3
  66. package/src/seeders/seed-data/solid-core-metadata.json +32 -32
  67. package/src/services/crud.service.ts +18 -1
  68. package/src/services/draft-publish-helper.service.ts +14 -9
  69. package/src/services/{workflow-secret.service.ts → secret.service.ts} +18 -18
  70. package/src/services/workflow/workflow-runtime.service.ts +3 -3
  71. package/src/solid-core.module.ts +8 -8
  72. package/dist/controllers/workflow-secret.controller.d.ts +0 -24
  73. package/dist/controllers/workflow-secret.controller.d.ts.map +0 -1
  74. package/dist/controllers/workflow-secret.controller.js.map +0 -1
  75. package/dist/dtos/create-workflow-secret.dto.d.ts.map +0 -1
  76. package/dist/dtos/create-workflow-secret.dto.js.map +0 -1
  77. package/dist/dtos/update-workflow-secret.dto.d.ts.map +0 -1
  78. package/dist/dtos/update-workflow-secret.dto.js.map +0 -1
  79. package/dist/entities/workflow-secret.entity.d.ts.map +0 -1
  80. package/dist/entities/workflow-secret.entity.js.map +0 -1
  81. package/dist/repository/workflow-secret.repository.d.ts.map +0 -1
  82. package/dist/repository/workflow-secret.repository.js.map +0 -1
  83. package/dist/services/workflow-secret.service.d.ts.map +0 -1
  84. package/dist/services/workflow-secret.service.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-runtime.service.js","sourceRoot":"","sources":["../../../src/services/workflow/workflow-runtime.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,2CAA4F;AAC5F,6CAAsD;AACtD,qCAAwC;AACxC,0FAA+E;AAC/E,wFAA6E;AAC7E,kGAAsF;AAQtF,2FAAqF;AACrF,+EAA0E;AAC1E,mGAA6F;AAC7F,qFAA+E;AAC/E,wEAAmE;AACnE,mFAAuE;AAEvE,gDAAwB;AAGjB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O,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAEO,cAAc,CAAC,KAAc;QACnC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;CACF,CAAA;AA94BY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,6BAAmB,EAAC,SAAS,CAAC,CAAA;qCACC,uBAAa;QAClB,4DAA2B;QACzB,uDAAyB;QAC7B,kEAA8B;QAC3B,0EAAkC;QACtB,+CAAqB;QACT,4CAAgB;GAX3D,sBAAsB,CA84BlC","sourcesContent":["import { BadRequestException, Injectable, Logger, NotFoundException } from '@nestjs/common';\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { EntityManager } from 'typeorm';\nimport { WorkflowDefinition } from '../../entities/workflow-definition.entity';\nimport { WorkflowExecution } from '../../entities/workflow-execution.entity';\nimport { WorkflowStepExecution } from '../../entities/workflow-step-execution.entity';\nimport {\n WorkflowDefinitionDsl,\n WorkflowExecutionRequest,\n WorkflowExecutionResponse,\n WorkflowNodeDefinition,\n WorkflowRuntimeContext,\n} from '../../types/workflow-dsl.types';\nimport { WorkflowExecutionWriterService } from './workflow-execution-writer.service';\nimport { WorkflowExpressionService } from './workflow-expression.service';\nimport { WorkflowDefinitionValidatorService } from './workflow-definition-validator.service';\nimport { WorkflowNodeRegistryService } from './workflow-node-registry.service';\nimport { WorkflowSecretService } from '../workflow-secret.service';\nimport { PublisherFactory } from '../queues/publisher-factory.service';\nimport { WorkflowExecutionQueuePayload } from '../../types/workflow-execution-queue.types';\nimport YAML from 'yaml';\n\n@Injectable()\nexport class WorkflowRuntimeService {\n private readonly logger = new Logger(WorkflowRuntimeService.name);\n\n constructor(\n @InjectEntityManager('default')\n private readonly entityManager: EntityManager,\n private readonly registry: WorkflowNodeRegistryService,\n private readonly expression: WorkflowExpressionService,\n private readonly writer: WorkflowExecutionWriterService,\n private readonly validator: WorkflowDefinitionValidatorService,\n private readonly workflowSecretService: WorkflowSecretService,\n private readonly workflowExecutionPublisherFactory: PublisherFactory<WorkflowExecutionQueuePayload>,\n ) {}\n\n async executeDefinitionById(\n id: number,\n request: WorkflowExecutionRequest,\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { id } as any,\n });\n\n return this.executeDefinition(definition, request);\n }\n\n async executeDefinitionByIdAsync(\n id: number,\n request: WorkflowExecutionRequest = {},\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { id } as any,\n });\n\n return this.enqueueDefinition(definition, request);\n }\n\n async executeDefinitionByKey(\n key: string,\n request: WorkflowExecutionRequest,\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { key } as any,\n });\n\n return this.executeDefinition(definition, request);\n }\n\n async executeDefinitionByKeyAsync(\n key: string,\n request: WorkflowExecutionRequest = {},\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { key } as any,\n });\n\n return this.enqueueDefinition(definition, request);\n }\n\n private async queueWorkflowExecution(\n payload: WorkflowExecutionQueuePayload,\n ): Promise<string> {\n const messageId = await this.workflowExecutionPublisherFactory.publish(\n {\n payload,\n parentEntityId: payload.executionId,\n parentEntity: 'workflowExecution',\n retryCount: 0,\n retryInterval: 1000,\n },\n 'WorkflowExecutionPublisher',\n );\n\n this.logger.log(\n `Queued workflow execution message ${messageId} for execution id ${payload.executionId}.`,\n );\n\n return messageId;\n }\n\n private async enqueueDefinition(\n definition: WorkflowDefinition | null,\n request: WorkflowExecutionRequest,\n ): Promise<WorkflowExecutionResponse> {\n if (!definition) {\n throw new BadRequestException('Workflow definition not found.');\n }\n\n this.validator.validate(this.assertDefinitionYaml(definition.definitionYaml));\n const execution = await this.writer.createEnqueuedExecution(definition, request);\n await this.queueWorkflowExecution({\n executionId: execution.id,\n });\n\n return this.toResponse(execution);\n }\n\n async executeEnqueuedExecution(\n executionId: number,\n ): Promise<WorkflowExecutionResponse> {\n const execution = await this.entityManager.findOne(WorkflowExecution, {\n where: { id: executionId } as any,\n relations: ['workflowDefinition'],\n });\n\n if (!execution) {\n throw new NotFoundException(`Workflow execution ${executionId} not found.`);\n }\n\n if (execution.status !== 'enqueued') {\n throw new BadRequestException(\n `Workflow execution ${executionId} is ${execution.status}; expected enqueued.`,\n );\n }\n\n const request = this.readEnqueuedExecutionRequest(execution);\n return this.executeDefinition(execution.workflowDefinition, request, execution);\n }\n\n private async executeDefinition(\n definition: WorkflowDefinition | null,\n request: WorkflowExecutionRequest,\n existingExecution?: WorkflowExecution,\n ): Promise<WorkflowExecutionResponse> {\n if (!definition) {\n throw new BadRequestException('Workflow definition not found.');\n }\n\n const definitionDsl = this.assertDefinitionYaml(definition.definitionYaml);\n this.validator.validate(definitionDsl);\n const secrets = await this.workflowSecretService.getWorkflowSecretsContext();\n const input = this.resolveWorkflowInput(definitionDsl, request, secrets);\n const variables = this.resolveWorkflowVariables(definitionDsl, request, input, secrets);\n const effectiveRequest: WorkflowExecutionRequest = {\n ...request,\n input,\n variables,\n };\n const execution = existingExecution\n ? await this.writer.startExecution(existingExecution, effectiveRequest)\n : await this.writer.createExecution(definition, effectiveRequest);\n const nodeCount = this.countNodes([\n ...(definitionDsl.nodes ?? []),\n ...(definitionDsl.errors ?? []),\n ...(definitionDsl.finally ?? []),\n ]);\n const outputs: Record<string, any> = {};\n const runtimeContext: WorkflowRuntimeContext = {\n execution,\n input,\n variables,\n secrets,\n outputs,\n counters: {\n step: 0,\n log: 0,\n },\n };\n\n this.logger.log(\n `Starting workflow execution ${execution.executionIdentifier} for ${definition.key} with ${nodeCount} node(s).`,\n );\n await this.writer.writeLog(execution, undefined, {\n level: 'info',\n eventType: 'execution.started',\n message: `Workflow execution started for ${definition.key}.`,\n metadata: {\n executionIdentifier: execution.executionIdentifier,\n workflowKey: definition.key,\n triggerType: execution.triggerType,\n nodeCount,\n inputKeys: Object.keys(runtimeContext.input ?? {}),\n variableKeys: Object.keys(runtimeContext.variables ?? {}),\n },\n }, this.nextLogSequence(runtimeContext));\n\n let executionError: unknown;\n\n try {\n await this.runNodes(definitionDsl.nodes, runtimeContext);\n } catch (error) {\n executionError = error;\n await this.runGlobalErrorHandlers(definitionDsl, runtimeContext, error);\n }\n\n try {\n await this.runFinallyHandlers(definitionDsl, runtimeContext);\n } catch (finallyError) {\n await this.writer.writeLog(execution, undefined, {\n level: 'error',\n eventType: 'finally.failed',\n message: `Finally handler failed: ${this.errorMessage(finallyError)}.`,\n context: this.summarizeError(finallyError),\n metadata: {\n originalError: executionError\n ? this.summarizeError(executionError)\n : undefined,\n },\n }, this.nextLogSequence(runtimeContext));\n if (!executionError) {\n executionError = finallyError;\n }\n }\n\n if (!executionError) {\n const completed = await this.writer.completeExecution(execution, outputs);\n\n this.logger.log(\n `Completed workflow execution ${completed.executionIdentifier} for ${definition.key} in ${completed.durationMs ?? 0} ms.`,\n );\n await this.writer.writeLog(completed, undefined, {\n level: 'info',\n eventType: 'execution.completed',\n message: `Workflow execution completed for ${definition.key}.`,\n metadata: {\n executionIdentifier: completed.executionIdentifier,\n durationMs: completed.durationMs,\n outputNodeIds: Object.keys(outputs),\n },\n }, this.nextLogSequence(runtimeContext));\n\n return this.toResponse(completed);\n }\n\n const failed = await this.writer.failExecution(execution, executionError);\n\n this.logger.error(\n `Failed workflow execution ${failed.executionIdentifier} for ${definition.key}: ${failed.errorSummary}`,\n executionError instanceof Error ? executionError.stack : undefined,\n );\n await this.writer.writeLog(failed, undefined, {\n level: 'error',\n eventType: 'execution.failed',\n message: failed.errorSummary,\n context: this.summarizeError(executionError),\n metadata: {\n executionIdentifier: failed.executionIdentifier,\n durationMs: failed.durationMs,\n },\n }, this.nextLogSequence(runtimeContext));\n\n return this.toResponse(failed);\n }\n\n async getExecutionStatus(executionId: number): Promise<WorkflowExecutionResponse> {\n const execution = await this.findExecutionOrThrow(executionId);\n return this.toResponse(execution);\n }\n\n async getLastStepOutput(executionId: number): Promise<any> {\n await this.findExecutionOrThrow(executionId);\n const step = await this.entityManager.findOne(WorkflowStepExecution, {\n where: { workflowExecution: { id: executionId } } as any,\n order: {\n sequenceNumber: 'DESC',\n id: 'DESC',\n } as any,\n });\n\n if (!step) {\n throw new NotFoundException(`No step executions found for workflow execution ${executionId}.`);\n }\n\n return this.toStepOutputResponse(step);\n }\n\n async getStepOutput(\n executionId: number,\n stepNameOrId: string,\n options: { latest?: boolean; limit?: number; offset?: number } = {},\n ): Promise<any> {\n await this.findExecutionOrThrow(executionId);\n\n const qb = this.entityManager\n .createQueryBuilder(WorkflowStepExecution, 'step')\n .innerJoin('step.workflowExecution', 'execution')\n .where('execution.id = :executionId', { executionId })\n .andWhere(\n '(step.nodeId = :stepNameOrId OR step.nodeName = :stepNameOrId OR step.stepExecutionKey = :stepNameOrId)',\n { stepNameOrId },\n )\n .orderBy('step.sequenceNumber', options.latest === false ? 'ASC' : 'DESC')\n .addOrderBy('step.id', options.latest === false ? 'ASC' : 'DESC');\n\n if (options.latest !== false && options.limit === undefined && options.offset === undefined) {\n const step = await qb.getOne();\n if (!step) {\n throw new NotFoundException(\n `No step output found for '${stepNameOrId}' in workflow execution ${executionId}.`,\n );\n }\n return this.toStepOutputResponse(step);\n }\n\n const limit = Math.max(1, Math.min(Number(options.limit ?? 50), 200));\n const offset = Math.max(0, Number(options.offset ?? 0));\n const [steps, totalRecords] = await qb.limit(limit).offset(offset).getManyAndCount();\n\n return {\n meta: this.buildPagedMeta(offset, limit, totalRecords),\n records: steps.map((step) => this.toStepOutputResponse(step)),\n };\n }\n\n private resolveWorkflowInput(\n definitionDsl: WorkflowDefinitionDsl,\n request: WorkflowExecutionRequest,\n secrets: Record<string, any>,\n ): Record<string, any> {\n const requestedInput = request.input ?? {};\n const defaultInput = Object.entries(definitionDsl.inputs ?? {}).reduce(\n (acc, [key, inputDefinition]) => {\n if (\n inputDefinition &&\n typeof inputDefinition === 'object' &&\n !Array.isArray(inputDefinition) &&\n Object.prototype.hasOwnProperty.call(inputDefinition, 'default')\n ) {\n acc[key] = inputDefinition.default;\n return acc;\n }\n\n if (\n inputDefinition === null ||\n inputDefinition === undefined ||\n (typeof inputDefinition === 'object' && !Array.isArray(inputDefinition))\n ) {\n return acc;\n }\n\n acc[key] = inputDefinition;\n return acc;\n },\n {} as Record<string, any>,\n );\n const rawInput = {\n ...defaultInput,\n ...requestedInput,\n };\n\n return this.expression.interpolate(rawInput, {\n execution: undefined as any,\n input: rawInput,\n variables: definitionDsl.variables ?? {},\n secrets,\n outputs: {},\n });\n }\n\n private resolveWorkflowVariables(\n definitionDsl: WorkflowDefinitionDsl,\n request: WorkflowExecutionRequest,\n input: Record<string, any>,\n secrets: Record<string, any>,\n ): Record<string, any> {\n const rawVariables = {\n ...(definitionDsl.variables ?? {}),\n ...(request.variables ?? {}),\n };\n\n return this.expression.interpolate(rawVariables, {\n execution: undefined as any,\n input,\n variables: rawVariables,\n secrets,\n outputs: {},\n });\n }\n\n private async runNodes(\n nodes: WorkflowNodeDefinition[],\n context: WorkflowRuntimeContext,\n ): Promise<Record<string, any>> {\n const nodeOutputs: Record<string, any> = {};\n\n for (const node of nodes ?? []) {\n nodeOutputs[node.id] = await this.runNode(node, context);\n }\n\n return nodeOutputs;\n }\n\n private async runNode(\n node: WorkflowNodeDefinition,\n context: WorkflowRuntimeContext,\n ): Promise<Record<string, any>> {\n const inputPayload = {\n configuration: node.configuration,\n input: context.input,\n variables: context.variables,\n item: context.item,\n index: context.index,\n };\n\n const step = await this.writer.createStep(\n context.execution,\n node,\n this.nextStepSequence(context),\n inputPayload,\n context.parentNodeId,\n context.parentStepExecutionKey,\n );\n\n if (node.disabled) {\n context.outputs[node.id] = { skipped: true };\n await this.writer.completeStep(step, 'skipped', context.outputs[node.id]);\n await this.writer.writeLog(context.execution, step, {\n level: 'debug',\n eventType: 'node.skipped',\n message: `Skipped disabled node ${node.id}.`,\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n return context.outputs[node.id];\n }\n\n try {\n await this.writer.writeLog(context.execution, step, {\n level: 'debug',\n eventType: 'node.started',\n message: `Starting node ${node.id} (${node.type}).`,\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n\n this.logger.debug(\n `Starting workflow node ${node.id} (${node.type}) for execution ${context.execution.executionIdentifier}.`,\n );\n const startedAtMs = Date.now();\n const handler = this.registry.get(node.type);\n const result = await handler.execute({\n ...context,\n node,\n stepExecution: step,\n expression: this.expression,\n runNodes: async (childNodes, options = {}) =>\n this.runNodes(childNodes, {\n ...context,\n ...options,\n execution: context.execution,\n outputs: options.outputs ?? context.outputs,\n parentNodeId: node.id,\n parentStepExecutionKey: step.stepExecutionKey,\n }),\n emitLog: async (entry) => {\n await this.writer.writeLog(\n context.execution,\n step,\n entry,\n this.nextLogSequence(context),\n );\n },\n emitArtifact: async (entry) => {\n await this.writer.writeArtifact(context.execution, step, entry);\n },\n });\n\n const output = result.output ?? {};\n context.outputs[node.id] = this.getRuntimeContextOutput(node, output);\n\n for (const artifact of result.artifacts ?? []) {\n await this.writer.writeArtifact(context.execution, step, artifact);\n }\n\n await this.writer.completeStep(\n step,\n result.status ?? 'success',\n output,\n {\n item: context.item,\n index: context.index,\n },\n );\n\n await this.writer.writeLog(context.execution, step, {\n level: 'debug',\n eventType: 'node.completed',\n message: `Completed node ${node.id} (${node.type}).`,\n metadata: {\n ...this.nodeLogMetadata(node, context, step),\n status: result.status ?? 'success',\n durationMs: Date.now() - startedAtMs,\n outputSummary: this.summarizeValue(output),\n artifactCount: result.artifacts?.length ?? 0,\n },\n }, this.nextLogSequence(context));\n\n return output;\n } catch (error) {\n await this.writer.failStep(step, error);\n\n if (node.onError === 'continue') {\n context.outputs[node.id] = {\n error: error instanceof Error ? error.message : String(error),\n };\n await this.writer.writeLog(context.execution, step, {\n level: 'warn',\n eventType: 'node.failed.continued',\n message: `Node ${node.id} failed but workflow continued: ${this.errorMessage(error)}.`,\n context: this.summarizeError(error),\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n return context.outputs[node.id];\n }\n\n await this.writer.writeLog(context.execution, step, {\n level: 'error',\n eventType: 'node.failed',\n message: `Node ${node.id} failed: ${this.errorMessage(error)}.`,\n context: this.summarizeError(error),\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n await this.runLocalErrorHandlers(node, context, error);\n throw error;\n }\n }\n\n private async runGlobalErrorHandlers(\n definitionDsl: WorkflowDefinitionDsl,\n context: WorkflowRuntimeContext,\n error: unknown,\n ): Promise<void> {\n const errorNodes = definitionDsl.errors ?? [];\n if (!errorNodes.length) {\n return;\n }\n\n await this.runErrorHandlers(\n errorNodes,\n context,\n error,\n 'global',\n undefined,\n undefined,\n );\n }\n\n private async runFinallyHandlers(\n definitionDsl: WorkflowDefinitionDsl,\n context: WorkflowRuntimeContext,\n ): Promise<void> {\n const finallyNodes = definitionDsl.finally ?? [];\n if (!finallyNodes.length) {\n return;\n }\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'info',\n eventType: 'finally.started',\n message: 'Running workflow finally handlers.',\n metadata: {\n handlerNodeCount: finallyNodes.length,\n },\n }, this.nextLogSequence(context));\n\n await this.runNodes(finallyNodes, context);\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'info',\n eventType: 'finally.completed',\n message: 'Workflow finally handlers completed.',\n metadata: {\n handlerNodeCount: finallyNodes.length,\n },\n }, this.nextLogSequence(context));\n }\n\n private async runLocalErrorHandlers(\n node: WorkflowNodeDefinition,\n context: WorkflowRuntimeContext,\n error: unknown,\n ): Promise<void> {\n const errorNodes = node.errors ?? [];\n if (!errorNodes.length) {\n return;\n }\n\n await this.runErrorHandlers(\n errorNodes,\n context,\n error,\n 'local',\n node.id,\n context.stepExecution?.stepExecutionKey,\n );\n }\n\n private async runErrorHandlers(\n errorNodes: WorkflowNodeDefinition[],\n context: WorkflowRuntimeContext,\n error: unknown,\n scope: 'global' | 'local',\n sourceNodeId?: string,\n sourceStepExecutionKey?: string,\n ): Promise<void> {\n const errorContext = this.buildErrorContext(error, sourceNodeId, sourceStepExecutionKey);\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'warn',\n eventType: `error-handler.${scope}.started`,\n message:\n scope === 'global'\n ? 'Running workflow-level error handlers.'\n : `Running local error handlers for node ${sourceNodeId}.`,\n context: errorContext,\n metadata: {\n sourceNodeId,\n sourceStepExecutionKey,\n handlerNodeCount: errorNodes.length,\n },\n }, this.nextLogSequence(context));\n\n try {\n await this.runNodes(errorNodes, {\n ...context,\n error: errorContext,\n parentNodeId: sourceNodeId ?? context.parentNodeId,\n parentStepExecutionKey:\n sourceStepExecutionKey ?? context.parentStepExecutionKey,\n });\n } catch (handlerError) {\n await this.writer.writeLog(context.execution, undefined, {\n level: 'error',\n eventType: `error-handler.${scope}.failed`,\n message: `Error handler failed: ${this.errorMessage(handlerError)}.`,\n context: this.summarizeError(handlerError),\n metadata: {\n originalError: errorContext,\n sourceNodeId,\n sourceStepExecutionKey,\n },\n }, this.nextLogSequence(context));\n return;\n }\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'info',\n eventType: `error-handler.${scope}.completed`,\n message:\n scope === 'global'\n ? 'Workflow-level error handlers completed.'\n : `Local error handlers completed for node ${sourceNodeId}.`,\n context: errorContext,\n metadata: {\n sourceNodeId,\n sourceStepExecutionKey,\n },\n }, this.nextLogSequence(context));\n }\n\n private buildErrorContext(\n error: unknown,\n nodeId?: string,\n stepExecutionKey?: string,\n ): Record<string, any> {\n const summary = this.summarizeError(error);\n return {\n ...summary,\n message: this.errorMessage(error),\n nodeId,\n stepExecutionKey,\n };\n }\n\n private assertDefinitionYaml(value: any): WorkflowDefinitionDsl {\n if (!value || typeof value !== 'string') {\n throw new BadRequestException(\n 'Workflow definition YAML must be stored as a string.',\n );\n }\n\n let parsed: unknown;\n try {\n parsed = YAML.parse(value);\n } catch (error: any) {\n throw new BadRequestException(\n error?.message ?? 'Workflow definition YAML could not be parsed.',\n );\n }\n\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new BadRequestException(\n 'Workflow definition YAML must resolve to an object with a nodes array.',\n );\n }\n\n if (!Array.isArray((parsed as WorkflowDefinitionDsl).nodes)) {\n throw new BadRequestException(\n 'Workflow definition YAML must include a nodes array.',\n );\n }\n\n return parsed as WorkflowDefinitionDsl;\n }\n\n private readEnqueuedExecutionRequest(execution: WorkflowExecution): WorkflowExecutionRequest {\n const payload = execution.inputPayload;\n if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {\n return {\n triggerType: execution.triggerType,\n requestedByUserId: execution.requestedByUserId as any,\n };\n }\n\n return {\n ...(payload as WorkflowExecutionRequest),\n triggerType: (payload as WorkflowExecutionRequest).triggerType ?? execution.triggerType,\n requestedByUserId:\n (payload as WorkflowExecutionRequest).requestedByUserId ??\n (execution.requestedByUserId as any),\n };\n }\n\n private async findExecutionOrThrow(executionId: number): Promise<WorkflowExecution> {\n const execution = await this.entityManager.findOne(WorkflowExecution, {\n where: { id: executionId } as any,\n });\n\n if (!execution) {\n throw new NotFoundException(`Workflow execution ${executionId} not found.`);\n }\n\n return execution;\n }\n\n private toStepOutputResponse(step: WorkflowStepExecution) {\n return {\n id: step.id,\n stepExecutionKey: step.stepExecutionKey,\n nodeId: step.nodeId,\n nodeName: step.nodeName,\n nodeType: step.nodeType,\n nodeKind: step.nodeKind,\n sequenceNumber: step.sequenceNumber,\n attemptNumber: step.attemptNumber,\n status: step.status,\n startedAt: step.startedAt,\n finishedAt: step.finishedAt,\n durationMs: step.durationMs as any,\n runtimeContext: step.runtimeContext,\n outputPayload: step.outputPayload,\n errorSummary: step.errorSummary,\n };\n }\n\n private buildPagedMeta(offset: number, limit: number, totalRecords: number) {\n const currentPage = limit ? Math.floor(offset / limit) + 1 : 1;\n const totalPages = limit ? Math.max(1, Math.ceil(totalRecords / limit)) : 1;\n return {\n totalRecords,\n currentPage,\n nextPage: currentPage < totalPages ? currentPage + 1 : null,\n prevPage: currentPage > 1 ? currentPage - 1 : null,\n totalPages,\n perPage: limit,\n };\n }\n\n private toResponse(execution: WorkflowExecution): WorkflowExecutionResponse {\n return {\n id: execution.id,\n executionIdentifier: execution.executionIdentifier,\n workflowKey: execution.workflowKey,\n status: execution.status as any,\n startedAt: execution.startedAt,\n finishedAt: execution.finishedAt,\n durationMs: execution.durationMs as any,\n outputPayload: execution.outputPayload,\n errorSummary: execution.errorSummary,\n };\n }\n\n private nextStepSequence(context: WorkflowRuntimeContext): number {\n context.counters = context.counters ?? { step: 0, log: 0 };\n context.counters.step += 1;\n return context.counters.step;\n }\n\n private nextLogSequence(context: WorkflowRuntimeContext): number {\n context.counters = context.counters ?? { step: 0, log: 0 };\n context.counters.log += 1;\n return context.counters.log;\n }\n\n private countNodes(nodes: WorkflowNodeDefinition[] = []): number {\n return nodes.reduce((count, node) => {\n const nestedNodes = [\n ...(node.tasks ?? []),\n ...(node.then ?? []),\n ...(node.else ?? []),\n ...(node.defaults ?? []),\n ...(node.errors ?? []),\n ...Object.values(node.cases ?? {}).flat(),\n ];\n\n return count + 1 + this.countNodes(nestedNodes);\n }, 0);\n }\n\n private nodeLogMetadata(\n node: WorkflowNodeDefinition,\n context: WorkflowRuntimeContext,\n step?: WorkflowStepExecution,\n ) {\n return {\n executionIdentifier: context.execution.executionIdentifier,\n stepExecutionKey: step?.stepExecutionKey,\n nodeId: node.id,\n nodeName: node.name,\n nodeType: node.type,\n nodeKind: node.kind,\n parentNodeId: context.parentNodeId,\n parentStepExecutionKey: context.parentStepExecutionKey,\n index: context.index,\n hasItem: context.item !== undefined,\n configurationKeys:\n node.configuration && typeof node.configuration === 'object'\n ? Object.keys(node.configuration)\n : [],\n availableInputKeys: Object.keys(context.input ?? {}),\n availableVariableKeys: Object.keys(context.variables ?? {}),\n availableOutputNodeIds: Object.keys(context.outputs ?? {}),\n };\n }\n\n private getRuntimeContextOutput(\n node: WorkflowNodeDefinition,\n output: Record<string, any>,\n ): Record<string, any> {\n const hiddenOutputPaths =\n this.registry\n .getMetadata(node.type)\n .authoring?.outputs?.filter(\n (definition) => definition.includeInRuntimeContext === false,\n )\n .map((definition) => definition.path ?? definition.key)\n .filter(Boolean) ?? [];\n\n if (!hiddenOutputPaths.length || !output || typeof output !== 'object') {\n return output;\n }\n\n const runtimeOutput = this.cloneOutput(output);\n hiddenOutputPaths.forEach((path) => {\n this.deletePath(runtimeOutput, path);\n });\n\n return runtimeOutput;\n }\n\n private cloneOutput(output: Record<string, any>): Record<string, any> {\n if (typeof structuredClone === 'function') {\n return structuredClone(output);\n }\n\n return JSON.parse(JSON.stringify(output));\n }\n\n private deletePath(target: Record<string, any>, path: string) {\n const parts = path.split('.').filter(Boolean);\n if (!parts.length) {\n return;\n }\n\n let cursor: any = target;\n for (let index = 0; index < parts.length - 1; index += 1) {\n cursor = cursor?.[parts[index]];\n if (!cursor || typeof cursor !== 'object') {\n return;\n }\n }\n\n if (cursor && typeof cursor === 'object') {\n delete cursor[parts[parts.length - 1]];\n }\n }\n\n private summarizeValue(value: any): any {\n if (Array.isArray(value)) {\n return {\n type: 'array',\n length: value.length,\n };\n }\n\n if (value && typeof value === 'object') {\n return {\n type: 'object',\n keys: Object.keys(value),\n };\n }\n\n return {\n type: value === null ? 'null' : typeof value,\n empty: value === undefined || value === null || value === '',\n };\n }\n\n private errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n }\n\n private summarizeError(error: unknown): any {\n if (error instanceof Error) {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n };\n }\n\n return { error };\n }\n}\n"]}
1
+ {"version":3,"file":"workflow-runtime.service.js","sourceRoot":"","sources":["../../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AAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK;YAC5C,KAAK,EAAE,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;SAC7D,CAAC;IACJ,CAAC;IAEO,YAAY,CAAC,KAAc;QACjC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAEO,cAAc,CAAC,KAAc;QACnC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;CACF,CAAA;AA94BY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,6BAAmB,EAAC,SAAS,CAAC,CAAA;qCACC,uBAAa;QAClB,4DAA2B;QACzB,uDAAyB;QAC7B,kEAA8B;QAC3B,0EAAkC;QAC9B,8BAAa;QACO,4CAAgB;GAX3D,sBAAsB,CA84BlC","sourcesContent":["import { BadRequestException, Injectable, Logger, NotFoundException } from '@nestjs/common';\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { EntityManager } from 'typeorm';\nimport { WorkflowDefinition } from '../../entities/workflow-definition.entity';\nimport { WorkflowExecution } from '../../entities/workflow-execution.entity';\nimport { WorkflowStepExecution } from '../../entities/workflow-step-execution.entity';\nimport {\n WorkflowDefinitionDsl,\n WorkflowExecutionRequest,\n WorkflowExecutionResponse,\n WorkflowNodeDefinition,\n WorkflowRuntimeContext,\n} from '../../types/workflow-dsl.types';\nimport { WorkflowExecutionWriterService } from './workflow-execution-writer.service';\nimport { WorkflowExpressionService } from './workflow-expression.service';\nimport { WorkflowDefinitionValidatorService } from './workflow-definition-validator.service';\nimport { WorkflowNodeRegistryService } from './workflow-node-registry.service';\nimport { SecretService } from '../secret.service';\nimport { PublisherFactory } from '../queues/publisher-factory.service';\nimport { WorkflowExecutionQueuePayload } from '../../types/workflow-execution-queue.types';\nimport YAML from 'yaml';\n\n@Injectable()\nexport class WorkflowRuntimeService {\n private readonly logger = new Logger(WorkflowRuntimeService.name);\n\n constructor(\n @InjectEntityManager('default')\n private readonly entityManager: EntityManager,\n private readonly registry: WorkflowNodeRegistryService,\n private readonly expression: WorkflowExpressionService,\n private readonly writer: WorkflowExecutionWriterService,\n private readonly validator: WorkflowDefinitionValidatorService,\n private readonly secretService: SecretService,\n private readonly workflowExecutionPublisherFactory: PublisherFactory<WorkflowExecutionQueuePayload>,\n ) {}\n\n async executeDefinitionById(\n id: number,\n request: WorkflowExecutionRequest,\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { id } as any,\n });\n\n return this.executeDefinition(definition, request);\n }\n\n async executeDefinitionByIdAsync(\n id: number,\n request: WorkflowExecutionRequest = {},\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { id } as any,\n });\n\n return this.enqueueDefinition(definition, request);\n }\n\n async executeDefinitionByKey(\n key: string,\n request: WorkflowExecutionRequest,\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { key } as any,\n });\n\n return this.executeDefinition(definition, request);\n }\n\n async executeDefinitionByKeyAsync(\n key: string,\n request: WorkflowExecutionRequest = {},\n ): Promise<WorkflowExecutionResponse> {\n const definition = await this.entityManager.findOne(WorkflowDefinition, {\n where: { key } as any,\n });\n\n return this.enqueueDefinition(definition, request);\n }\n\n private async queueWorkflowExecution(\n payload: WorkflowExecutionQueuePayload,\n ): Promise<string> {\n const messageId = await this.workflowExecutionPublisherFactory.publish(\n {\n payload,\n parentEntityId: payload.executionId,\n parentEntity: 'workflowExecution',\n retryCount: 0,\n retryInterval: 1000,\n },\n 'WorkflowExecutionPublisher',\n );\n\n this.logger.log(\n `Queued workflow execution message ${messageId} for execution id ${payload.executionId}.`,\n );\n\n return messageId;\n }\n\n private async enqueueDefinition(\n definition: WorkflowDefinition | null,\n request: WorkflowExecutionRequest,\n ): Promise<WorkflowExecutionResponse> {\n if (!definition) {\n throw new BadRequestException('Workflow definition not found.');\n }\n\n this.validator.validate(this.assertDefinitionYaml(definition.definitionYaml));\n const execution = await this.writer.createEnqueuedExecution(definition, request);\n await this.queueWorkflowExecution({\n executionId: execution.id,\n });\n\n return this.toResponse(execution);\n }\n\n async executeEnqueuedExecution(\n executionId: number,\n ): Promise<WorkflowExecutionResponse> {\n const execution = await this.entityManager.findOne(WorkflowExecution, {\n where: { id: executionId } as any,\n relations: ['workflowDefinition'],\n });\n\n if (!execution) {\n throw new NotFoundException(`Workflow execution ${executionId} not found.`);\n }\n\n if (execution.status !== 'enqueued') {\n throw new BadRequestException(\n `Workflow execution ${executionId} is ${execution.status}; expected enqueued.`,\n );\n }\n\n const request = this.readEnqueuedExecutionRequest(execution);\n return this.executeDefinition(execution.workflowDefinition, request, execution);\n }\n\n private async executeDefinition(\n definition: WorkflowDefinition | null,\n request: WorkflowExecutionRequest,\n existingExecution?: WorkflowExecution,\n ): Promise<WorkflowExecutionResponse> {\n if (!definition) {\n throw new BadRequestException('Workflow definition not found.');\n }\n\n const definitionDsl = this.assertDefinitionYaml(definition.definitionYaml);\n this.validator.validate(definitionDsl);\n const secrets = await this.secretService.getSecretsContext();\n const input = this.resolveWorkflowInput(definitionDsl, request, secrets);\n const variables = this.resolveWorkflowVariables(definitionDsl, request, input, secrets);\n const effectiveRequest: WorkflowExecutionRequest = {\n ...request,\n input,\n variables,\n };\n const execution = existingExecution\n ? await this.writer.startExecution(existingExecution, effectiveRequest)\n : await this.writer.createExecution(definition, effectiveRequest);\n const nodeCount = this.countNodes([\n ...(definitionDsl.nodes ?? []),\n ...(definitionDsl.errors ?? []),\n ...(definitionDsl.finally ?? []),\n ]);\n const outputs: Record<string, any> = {};\n const runtimeContext: WorkflowRuntimeContext = {\n execution,\n input,\n variables,\n secrets,\n outputs,\n counters: {\n step: 0,\n log: 0,\n },\n };\n\n this.logger.log(\n `Starting workflow execution ${execution.executionIdentifier} for ${definition.key} with ${nodeCount} node(s).`,\n );\n await this.writer.writeLog(execution, undefined, {\n level: 'info',\n eventType: 'execution.started',\n message: `Workflow execution started for ${definition.key}.`,\n metadata: {\n executionIdentifier: execution.executionIdentifier,\n workflowKey: definition.key,\n triggerType: execution.triggerType,\n nodeCount,\n inputKeys: Object.keys(runtimeContext.input ?? {}),\n variableKeys: Object.keys(runtimeContext.variables ?? {}),\n },\n }, this.nextLogSequence(runtimeContext));\n\n let executionError: unknown;\n\n try {\n await this.runNodes(definitionDsl.nodes, runtimeContext);\n } catch (error) {\n executionError = error;\n await this.runGlobalErrorHandlers(definitionDsl, runtimeContext, error);\n }\n\n try {\n await this.runFinallyHandlers(definitionDsl, runtimeContext);\n } catch (finallyError) {\n await this.writer.writeLog(execution, undefined, {\n level: 'error',\n eventType: 'finally.failed',\n message: `Finally handler failed: ${this.errorMessage(finallyError)}.`,\n context: this.summarizeError(finallyError),\n metadata: {\n originalError: executionError\n ? this.summarizeError(executionError)\n : undefined,\n },\n }, this.nextLogSequence(runtimeContext));\n if (!executionError) {\n executionError = finallyError;\n }\n }\n\n if (!executionError) {\n const completed = await this.writer.completeExecution(execution, outputs);\n\n this.logger.log(\n `Completed workflow execution ${completed.executionIdentifier} for ${definition.key} in ${completed.durationMs ?? 0} ms.`,\n );\n await this.writer.writeLog(completed, undefined, {\n level: 'info',\n eventType: 'execution.completed',\n message: `Workflow execution completed for ${definition.key}.`,\n metadata: {\n executionIdentifier: completed.executionIdentifier,\n durationMs: completed.durationMs,\n outputNodeIds: Object.keys(outputs),\n },\n }, this.nextLogSequence(runtimeContext));\n\n return this.toResponse(completed);\n }\n\n const failed = await this.writer.failExecution(execution, executionError);\n\n this.logger.error(\n `Failed workflow execution ${failed.executionIdentifier} for ${definition.key}: ${failed.errorSummary}`,\n executionError instanceof Error ? executionError.stack : undefined,\n );\n await this.writer.writeLog(failed, undefined, {\n level: 'error',\n eventType: 'execution.failed',\n message: failed.errorSummary,\n context: this.summarizeError(executionError),\n metadata: {\n executionIdentifier: failed.executionIdentifier,\n durationMs: failed.durationMs,\n },\n }, this.nextLogSequence(runtimeContext));\n\n return this.toResponse(failed);\n }\n\n async getExecutionStatus(executionId: number): Promise<WorkflowExecutionResponse> {\n const execution = await this.findExecutionOrThrow(executionId);\n return this.toResponse(execution);\n }\n\n async getLastStepOutput(executionId: number): Promise<any> {\n await this.findExecutionOrThrow(executionId);\n const step = await this.entityManager.findOne(WorkflowStepExecution, {\n where: { workflowExecution: { id: executionId } } as any,\n order: {\n sequenceNumber: 'DESC',\n id: 'DESC',\n } as any,\n });\n\n if (!step) {\n throw new NotFoundException(`No step executions found for workflow execution ${executionId}.`);\n }\n\n return this.toStepOutputResponse(step);\n }\n\n async getStepOutput(\n executionId: number,\n stepNameOrId: string,\n options: { latest?: boolean; limit?: number; offset?: number } = {},\n ): Promise<any> {\n await this.findExecutionOrThrow(executionId);\n\n const qb = this.entityManager\n .createQueryBuilder(WorkflowStepExecution, 'step')\n .innerJoin('step.workflowExecution', 'execution')\n .where('execution.id = :executionId', { executionId })\n .andWhere(\n '(step.nodeId = :stepNameOrId OR step.nodeName = :stepNameOrId OR step.stepExecutionKey = :stepNameOrId)',\n { stepNameOrId },\n )\n .orderBy('step.sequenceNumber', options.latest === false ? 'ASC' : 'DESC')\n .addOrderBy('step.id', options.latest === false ? 'ASC' : 'DESC');\n\n if (options.latest !== false && options.limit === undefined && options.offset === undefined) {\n const step = await qb.getOne();\n if (!step) {\n throw new NotFoundException(\n `No step output found for '${stepNameOrId}' in workflow execution ${executionId}.`,\n );\n }\n return this.toStepOutputResponse(step);\n }\n\n const limit = Math.max(1, Math.min(Number(options.limit ?? 50), 200));\n const offset = Math.max(0, Number(options.offset ?? 0));\n const [steps, totalRecords] = await qb.limit(limit).offset(offset).getManyAndCount();\n\n return {\n meta: this.buildPagedMeta(offset, limit, totalRecords),\n records: steps.map((step) => this.toStepOutputResponse(step)),\n };\n }\n\n private resolveWorkflowInput(\n definitionDsl: WorkflowDefinitionDsl,\n request: WorkflowExecutionRequest,\n secrets: Record<string, any>,\n ): Record<string, any> {\n const requestedInput = request.input ?? {};\n const defaultInput = Object.entries(definitionDsl.inputs ?? {}).reduce(\n (acc, [key, inputDefinition]) => {\n if (\n inputDefinition &&\n typeof inputDefinition === 'object' &&\n !Array.isArray(inputDefinition) &&\n Object.prototype.hasOwnProperty.call(inputDefinition, 'default')\n ) {\n acc[key] = inputDefinition.default;\n return acc;\n }\n\n if (\n inputDefinition === null ||\n inputDefinition === undefined ||\n (typeof inputDefinition === 'object' && !Array.isArray(inputDefinition))\n ) {\n return acc;\n }\n\n acc[key] = inputDefinition;\n return acc;\n },\n {} as Record<string, any>,\n );\n const rawInput = {\n ...defaultInput,\n ...requestedInput,\n };\n\n return this.expression.interpolate(rawInput, {\n execution: undefined as any,\n input: rawInput,\n variables: definitionDsl.variables ?? {},\n secrets,\n outputs: {},\n });\n }\n\n private resolveWorkflowVariables(\n definitionDsl: WorkflowDefinitionDsl,\n request: WorkflowExecutionRequest,\n input: Record<string, any>,\n secrets: Record<string, any>,\n ): Record<string, any> {\n const rawVariables = {\n ...(definitionDsl.variables ?? {}),\n ...(request.variables ?? {}),\n };\n\n return this.expression.interpolate(rawVariables, {\n execution: undefined as any,\n input,\n variables: rawVariables,\n secrets,\n outputs: {},\n });\n }\n\n private async runNodes(\n nodes: WorkflowNodeDefinition[],\n context: WorkflowRuntimeContext,\n ): Promise<Record<string, any>> {\n const nodeOutputs: Record<string, any> = {};\n\n for (const node of nodes ?? []) {\n nodeOutputs[node.id] = await this.runNode(node, context);\n }\n\n return nodeOutputs;\n }\n\n private async runNode(\n node: WorkflowNodeDefinition,\n context: WorkflowRuntimeContext,\n ): Promise<Record<string, any>> {\n const inputPayload = {\n configuration: node.configuration,\n input: context.input,\n variables: context.variables,\n item: context.item,\n index: context.index,\n };\n\n const step = await this.writer.createStep(\n context.execution,\n node,\n this.nextStepSequence(context),\n inputPayload,\n context.parentNodeId,\n context.parentStepExecutionKey,\n );\n\n if (node.disabled) {\n context.outputs[node.id] = { skipped: true };\n await this.writer.completeStep(step, 'skipped', context.outputs[node.id]);\n await this.writer.writeLog(context.execution, step, {\n level: 'debug',\n eventType: 'node.skipped',\n message: `Skipped disabled node ${node.id}.`,\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n return context.outputs[node.id];\n }\n\n try {\n await this.writer.writeLog(context.execution, step, {\n level: 'debug',\n eventType: 'node.started',\n message: `Starting node ${node.id} (${node.type}).`,\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n\n this.logger.debug(\n `Starting workflow node ${node.id} (${node.type}) for execution ${context.execution.executionIdentifier}.`,\n );\n const startedAtMs = Date.now();\n const handler = this.registry.get(node.type);\n const result = await handler.execute({\n ...context,\n node,\n stepExecution: step,\n expression: this.expression,\n runNodes: async (childNodes, options = {}) =>\n this.runNodes(childNodes, {\n ...context,\n ...options,\n execution: context.execution,\n outputs: options.outputs ?? context.outputs,\n parentNodeId: node.id,\n parentStepExecutionKey: step.stepExecutionKey,\n }),\n emitLog: async (entry) => {\n await this.writer.writeLog(\n context.execution,\n step,\n entry,\n this.nextLogSequence(context),\n );\n },\n emitArtifact: async (entry) => {\n await this.writer.writeArtifact(context.execution, step, entry);\n },\n });\n\n const output = result.output ?? {};\n context.outputs[node.id] = this.getRuntimeContextOutput(node, output);\n\n for (const artifact of result.artifacts ?? []) {\n await this.writer.writeArtifact(context.execution, step, artifact);\n }\n\n await this.writer.completeStep(\n step,\n result.status ?? 'success',\n output,\n {\n item: context.item,\n index: context.index,\n },\n );\n\n await this.writer.writeLog(context.execution, step, {\n level: 'debug',\n eventType: 'node.completed',\n message: `Completed node ${node.id} (${node.type}).`,\n metadata: {\n ...this.nodeLogMetadata(node, context, step),\n status: result.status ?? 'success',\n durationMs: Date.now() - startedAtMs,\n outputSummary: this.summarizeValue(output),\n artifactCount: result.artifacts?.length ?? 0,\n },\n }, this.nextLogSequence(context));\n\n return output;\n } catch (error) {\n await this.writer.failStep(step, error);\n\n if (node.onError === 'continue') {\n context.outputs[node.id] = {\n error: error instanceof Error ? error.message : String(error),\n };\n await this.writer.writeLog(context.execution, step, {\n level: 'warn',\n eventType: 'node.failed.continued',\n message: `Node ${node.id} failed but workflow continued: ${this.errorMessage(error)}.`,\n context: this.summarizeError(error),\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n return context.outputs[node.id];\n }\n\n await this.writer.writeLog(context.execution, step, {\n level: 'error',\n eventType: 'node.failed',\n message: `Node ${node.id} failed: ${this.errorMessage(error)}.`,\n context: this.summarizeError(error),\n metadata: this.nodeLogMetadata(node, context, step),\n }, this.nextLogSequence(context));\n await this.runLocalErrorHandlers(node, context, error);\n throw error;\n }\n }\n\n private async runGlobalErrorHandlers(\n definitionDsl: WorkflowDefinitionDsl,\n context: WorkflowRuntimeContext,\n error: unknown,\n ): Promise<void> {\n const errorNodes = definitionDsl.errors ?? [];\n if (!errorNodes.length) {\n return;\n }\n\n await this.runErrorHandlers(\n errorNodes,\n context,\n error,\n 'global',\n undefined,\n undefined,\n );\n }\n\n private async runFinallyHandlers(\n definitionDsl: WorkflowDefinitionDsl,\n context: WorkflowRuntimeContext,\n ): Promise<void> {\n const finallyNodes = definitionDsl.finally ?? [];\n if (!finallyNodes.length) {\n return;\n }\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'info',\n eventType: 'finally.started',\n message: 'Running workflow finally handlers.',\n metadata: {\n handlerNodeCount: finallyNodes.length,\n },\n }, this.nextLogSequence(context));\n\n await this.runNodes(finallyNodes, context);\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'info',\n eventType: 'finally.completed',\n message: 'Workflow finally handlers completed.',\n metadata: {\n handlerNodeCount: finallyNodes.length,\n },\n }, this.nextLogSequence(context));\n }\n\n private async runLocalErrorHandlers(\n node: WorkflowNodeDefinition,\n context: WorkflowRuntimeContext,\n error: unknown,\n ): Promise<void> {\n const errorNodes = node.errors ?? [];\n if (!errorNodes.length) {\n return;\n }\n\n await this.runErrorHandlers(\n errorNodes,\n context,\n error,\n 'local',\n node.id,\n context.stepExecution?.stepExecutionKey,\n );\n }\n\n private async runErrorHandlers(\n errorNodes: WorkflowNodeDefinition[],\n context: WorkflowRuntimeContext,\n error: unknown,\n scope: 'global' | 'local',\n sourceNodeId?: string,\n sourceStepExecutionKey?: string,\n ): Promise<void> {\n const errorContext = this.buildErrorContext(error, sourceNodeId, sourceStepExecutionKey);\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'warn',\n eventType: `error-handler.${scope}.started`,\n message:\n scope === 'global'\n ? 'Running workflow-level error handlers.'\n : `Running local error handlers for node ${sourceNodeId}.`,\n context: errorContext,\n metadata: {\n sourceNodeId,\n sourceStepExecutionKey,\n handlerNodeCount: errorNodes.length,\n },\n }, this.nextLogSequence(context));\n\n try {\n await this.runNodes(errorNodes, {\n ...context,\n error: errorContext,\n parentNodeId: sourceNodeId ?? context.parentNodeId,\n parentStepExecutionKey:\n sourceStepExecutionKey ?? context.parentStepExecutionKey,\n });\n } catch (handlerError) {\n await this.writer.writeLog(context.execution, undefined, {\n level: 'error',\n eventType: `error-handler.${scope}.failed`,\n message: `Error handler failed: ${this.errorMessage(handlerError)}.`,\n context: this.summarizeError(handlerError),\n metadata: {\n originalError: errorContext,\n sourceNodeId,\n sourceStepExecutionKey,\n },\n }, this.nextLogSequence(context));\n return;\n }\n\n await this.writer.writeLog(context.execution, undefined, {\n level: 'info',\n eventType: `error-handler.${scope}.completed`,\n message:\n scope === 'global'\n ? 'Workflow-level error handlers completed.'\n : `Local error handlers completed for node ${sourceNodeId}.`,\n context: errorContext,\n metadata: {\n sourceNodeId,\n sourceStepExecutionKey,\n },\n }, this.nextLogSequence(context));\n }\n\n private buildErrorContext(\n error: unknown,\n nodeId?: string,\n stepExecutionKey?: string,\n ): Record<string, any> {\n const summary = this.summarizeError(error);\n return {\n ...summary,\n message: this.errorMessage(error),\n nodeId,\n stepExecutionKey,\n };\n }\n\n private assertDefinitionYaml(value: any): WorkflowDefinitionDsl {\n if (!value || typeof value !== 'string') {\n throw new BadRequestException(\n 'Workflow definition YAML must be stored as a string.',\n );\n }\n\n let parsed: unknown;\n try {\n parsed = YAML.parse(value);\n } catch (error: any) {\n throw new BadRequestException(\n error?.message ?? 'Workflow definition YAML could not be parsed.',\n );\n }\n\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new BadRequestException(\n 'Workflow definition YAML must resolve to an object with a nodes array.',\n );\n }\n\n if (!Array.isArray((parsed as WorkflowDefinitionDsl).nodes)) {\n throw new BadRequestException(\n 'Workflow definition YAML must include a nodes array.',\n );\n }\n\n return parsed as WorkflowDefinitionDsl;\n }\n\n private readEnqueuedExecutionRequest(execution: WorkflowExecution): WorkflowExecutionRequest {\n const payload = execution.inputPayload;\n if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {\n return {\n triggerType: execution.triggerType,\n requestedByUserId: execution.requestedByUserId as any,\n };\n }\n\n return {\n ...(payload as WorkflowExecutionRequest),\n triggerType: (payload as WorkflowExecutionRequest).triggerType ?? execution.triggerType,\n requestedByUserId:\n (payload as WorkflowExecutionRequest).requestedByUserId ??\n (execution.requestedByUserId as any),\n };\n }\n\n private async findExecutionOrThrow(executionId: number): Promise<WorkflowExecution> {\n const execution = await this.entityManager.findOne(WorkflowExecution, {\n where: { id: executionId } as any,\n });\n\n if (!execution) {\n throw new NotFoundException(`Workflow execution ${executionId} not found.`);\n }\n\n return execution;\n }\n\n private toStepOutputResponse(step: WorkflowStepExecution) {\n return {\n id: step.id,\n stepExecutionKey: step.stepExecutionKey,\n nodeId: step.nodeId,\n nodeName: step.nodeName,\n nodeType: step.nodeType,\n nodeKind: step.nodeKind,\n sequenceNumber: step.sequenceNumber,\n attemptNumber: step.attemptNumber,\n status: step.status,\n startedAt: step.startedAt,\n finishedAt: step.finishedAt,\n durationMs: step.durationMs as any,\n runtimeContext: step.runtimeContext,\n outputPayload: step.outputPayload,\n errorSummary: step.errorSummary,\n };\n }\n\n private buildPagedMeta(offset: number, limit: number, totalRecords: number) {\n const currentPage = limit ? Math.floor(offset / limit) + 1 : 1;\n const totalPages = limit ? Math.max(1, Math.ceil(totalRecords / limit)) : 1;\n return {\n totalRecords,\n currentPage,\n nextPage: currentPage < totalPages ? currentPage + 1 : null,\n prevPage: currentPage > 1 ? currentPage - 1 : null,\n totalPages,\n perPage: limit,\n };\n }\n\n private toResponse(execution: WorkflowExecution): WorkflowExecutionResponse {\n return {\n id: execution.id,\n executionIdentifier: execution.executionIdentifier,\n workflowKey: execution.workflowKey,\n status: execution.status as any,\n startedAt: execution.startedAt,\n finishedAt: execution.finishedAt,\n durationMs: execution.durationMs as any,\n outputPayload: execution.outputPayload,\n errorSummary: execution.errorSummary,\n };\n }\n\n private nextStepSequence(context: WorkflowRuntimeContext): number {\n context.counters = context.counters ?? { step: 0, log: 0 };\n context.counters.step += 1;\n return context.counters.step;\n }\n\n private nextLogSequence(context: WorkflowRuntimeContext): number {\n context.counters = context.counters ?? { step: 0, log: 0 };\n context.counters.log += 1;\n return context.counters.log;\n }\n\n private countNodes(nodes: WorkflowNodeDefinition[] = []): number {\n return nodes.reduce((count, node) => {\n const nestedNodes = [\n ...(node.tasks ?? []),\n ...(node.then ?? []),\n ...(node.else ?? []),\n ...(node.defaults ?? []),\n ...(node.errors ?? []),\n ...Object.values(node.cases ?? {}).flat(),\n ];\n\n return count + 1 + this.countNodes(nestedNodes);\n }, 0);\n }\n\n private nodeLogMetadata(\n node: WorkflowNodeDefinition,\n context: WorkflowRuntimeContext,\n step?: WorkflowStepExecution,\n ) {\n return {\n executionIdentifier: context.execution.executionIdentifier,\n stepExecutionKey: step?.stepExecutionKey,\n nodeId: node.id,\n nodeName: node.name,\n nodeType: node.type,\n nodeKind: node.kind,\n parentNodeId: context.parentNodeId,\n parentStepExecutionKey: context.parentStepExecutionKey,\n index: context.index,\n hasItem: context.item !== undefined,\n configurationKeys:\n node.configuration && typeof node.configuration === 'object'\n ? Object.keys(node.configuration)\n : [],\n availableInputKeys: Object.keys(context.input ?? {}),\n availableVariableKeys: Object.keys(context.variables ?? {}),\n availableOutputNodeIds: Object.keys(context.outputs ?? {}),\n };\n }\n\n private getRuntimeContextOutput(\n node: WorkflowNodeDefinition,\n output: Record<string, any>,\n ): Record<string, any> {\n const hiddenOutputPaths =\n this.registry\n .getMetadata(node.type)\n .authoring?.outputs?.filter(\n (definition) => definition.includeInRuntimeContext === false,\n )\n .map((definition) => definition.path ?? definition.key)\n .filter(Boolean) ?? [];\n\n if (!hiddenOutputPaths.length || !output || typeof output !== 'object') {\n return output;\n }\n\n const runtimeOutput = this.cloneOutput(output);\n hiddenOutputPaths.forEach((path) => {\n this.deletePath(runtimeOutput, path);\n });\n\n return runtimeOutput;\n }\n\n private cloneOutput(output: Record<string, any>): Record<string, any> {\n if (typeof structuredClone === 'function') {\n return structuredClone(output);\n }\n\n return JSON.parse(JSON.stringify(output));\n }\n\n private deletePath(target: Record<string, any>, path: string) {\n const parts = path.split('.').filter(Boolean);\n if (!parts.length) {\n return;\n }\n\n let cursor: any = target;\n for (let index = 0; index < parts.length - 1; index += 1) {\n cursor = cursor?.[parts[index]];\n if (!cursor || typeof cursor !== 'object') {\n return;\n }\n }\n\n if (cursor && typeof cursor === 'object') {\n delete cursor[parts[parts.length - 1]];\n }\n }\n\n private summarizeValue(value: any): any {\n if (Array.isArray(value)) {\n return {\n type: 'array',\n length: value.length,\n };\n }\n\n if (value && typeof value === 'object') {\n return {\n type: 'object',\n keys: Object.keys(value),\n };\n }\n\n return {\n type: value === null ? 'null' : typeof value,\n empty: value === undefined || value === null || value === '',\n };\n }\n\n private errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n }\n\n private summarizeError(error: unknown): any {\n if (error instanceof Error) {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n };\n }\n\n return { error };\n }\n}\n"]}
@@ -395,14 +395,14 @@ const workflow_step_execution_entity_1 = require("./entities/workflow-step-execu
395
395
  const workflow_execution_log_entity_1 = require("./entities/workflow-execution-log.entity");
396
396
  const workflow_execution_artifact_entity_1 = require("./entities/workflow-execution-artifact.entity");
397
397
  const workflow_trigger_execution_entity_1 = require("./entities/workflow-trigger-execution.entity");
398
- const workflow_secret_entity_1 = require("./entities/workflow-secret.entity");
398
+ const secret_entity_1 = require("./entities/secret.entity");
399
399
  const workflow_definition_controller_1 = require("./controllers/workflow-definition.controller");
400
400
  const workflow_execution_controller_1 = require("./controllers/workflow-execution.controller");
401
401
  const workflow_step_execution_controller_1 = require("./controllers/workflow-step-execution.controller");
402
402
  const workflow_execution_log_controller_1 = require("./controllers/workflow-execution-log.controller");
403
403
  const workflow_execution_artifact_controller_1 = require("./controllers/workflow-execution-artifact.controller");
404
404
  const workflow_trigger_execution_controller_1 = require("./controllers/workflow-trigger-execution.controller");
405
- const workflow_secret_controller_1 = require("./controllers/workflow-secret.controller");
405
+ const secret_controller_1 = require("./controllers/secret.controller");
406
406
  const workflow_definition_service_1 = require("./services/workflow-definition.service");
407
407
  const workflow_definition_metadata_sync_service_1 = require("./services/workflow/workflow-definition-metadata-sync.service");
408
408
  const workflow_execution_service_1 = require("./services/workflow-execution.service");
@@ -410,14 +410,14 @@ const workflow_step_execution_service_1 = require("./services/workflow-step-exec
410
410
  const workflow_execution_log_service_1 = require("./services/workflow-execution-log.service");
411
411
  const workflow_execution_artifact_service_1 = require("./services/workflow-execution-artifact.service");
412
412
  const workflow_trigger_execution_service_1 = require("./services/workflow-trigger-execution.service");
413
- const workflow_secret_service_1 = require("./services/workflow-secret.service");
413
+ const secret_service_1 = require("./services/secret.service");
414
414
  const workflow_definition_repository_1 = require("./repository/workflow-definition.repository");
415
415
  const workflow_execution_repository_1 = require("./repository/workflow-execution.repository");
416
416
  const workflow_step_execution_repository_1 = require("./repository/workflow-step-execution.repository");
417
417
  const workflow_execution_log_repository_1 = require("./repository/workflow-execution-log.repository");
418
418
  const workflow_execution_artifact_repository_1 = require("./repository/workflow-execution-artifact.repository");
419
419
  const workflow_trigger_execution_repository_1 = require("./repository/workflow-trigger-execution.repository");
420
- const workflow_secret_repository_1 = require("./repository/workflow-secret.repository");
420
+ const secret_repository_1 = require("./repository/secret.repository");
421
421
  const workflow_definition_validator_service_1 = require("./services/workflow/workflow-definition-validator.service");
422
422
  const workflow_execution_writer_service_1 = require("./services/workflow/workflow-execution-writer.service");
423
423
  const workflow_expression_service_1 = require("./services/workflow/workflow-expression.service");
@@ -489,7 +489,7 @@ exports.SolidCoreModule = SolidCoreModule = __decorate([
489
489
  workflow_execution_log_entity_1.WorkflowExecutionLog,
490
490
  workflow_execution_artifact_entity_1.WorkflowExecutionArtifact,
491
491
  workflow_trigger_execution_entity_1.WorkflowTriggerExecution,
492
- workflow_secret_entity_1.WorkflowSecret,
492
+ secret_entity_1.Secret,
493
493
  ]),
494
494
  cache_manager_1.CacheModule.registerAsync(cache_options_1.CacheManagerOptions),
495
495
  schedule_1.ScheduleModule.forRoot(),
@@ -592,7 +592,7 @@ exports.SolidCoreModule = SolidCoreModule = __decorate([
592
592
  workflow_execution_log_controller_1.WorkflowExecutionLogController,
593
593
  workflow_execution_artifact_controller_1.WorkflowExecutionArtifactController,
594
594
  workflow_trigger_execution_controller_1.WorkflowTriggerExecutionController,
595
- workflow_secret_controller_1.WorkflowSecretController,
595
+ secret_controller_1.SecretController,
596
596
  ],
597
597
  providers: [
598
598
  {
@@ -917,8 +917,8 @@ exports.SolidCoreModule = SolidCoreModule = __decorate([
917
917
  workflow_execution_artifact_repository_1.WorkflowExecutionArtifactRepository,
918
918
  workflow_trigger_execution_service_1.WorkflowTriggerExecutionService,
919
919
  workflow_trigger_execution_repository_1.WorkflowTriggerExecutionRepository,
920
- workflow_secret_service_1.WorkflowSecretService,
921
- workflow_secret_repository_1.WorkflowSecretRepository,
920
+ secret_service_1.SecretService,
921
+ secret_repository_1.SecretRepository,
922
922
  workflow_invocation_service_1.WorkflowInvocationService,
923
923
  workflow_runtime_service_1.WorkflowRuntimeService,
924
924
  workflow_execution_writer_service_1.WorkflowExecutionWriterService,