@solidxai/core 0.1.13-beta.2 → 0.1.13-beta.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/commands/seed.command.d.ts +2 -0
- package/dist/commands/seed.command.d.ts.map +1 -1
- package/dist/commands/seed.command.js +21 -0
- package/dist/commands/seed.command.js.map +1 -1
- package/dist/entities/saved-filters.entity.js +3 -3
- package/dist/entities/saved-filters.entity.js.map +1 -1
- package/dist/entities/workflow-trigger-execution.entity.js +1 -1
- package/dist/entities/workflow-trigger-execution.entity.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +1 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +44 -27
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +80 -67
- package/dist/services/workflow/nodes/execution-fail.node.d.ts +6 -0
- package/dist/services/workflow/nodes/execution-fail.node.d.ts.map +1 -0
- package/dist/services/workflow/nodes/execution-fail.node.js +81 -0
- package/dist/services/workflow/nodes/execution-fail.node.js.map +1 -0
- package/dist/services/workflow/nodes/for-each.node.d.ts +2 -0
- package/dist/services/workflow/nodes/for-each.node.d.ts.map +1 -1
- package/dist/services/workflow/nodes/for-each.node.js +114 -5
- package/dist/services/workflow/nodes/for-each.node.js.map +1 -1
- package/dist/services/workflow/nodes/if.node.d.ts.map +1 -1
- package/dist/services/workflow/nodes/if.node.js +7 -0
- package/dist/services/workflow/nodes/if.node.js.map +1 -1
- package/dist/services/workflow/nodes/log-write.node.d.ts.map +1 -1
- package/dist/services/workflow/nodes/log-write.node.js +2 -0
- package/dist/services/workflow/nodes/log-write.node.js.map +1 -1
- package/dist/services/workflow/nodes/loop-until.node.d.ts +12 -0
- package/dist/services/workflow/nodes/loop-until.node.d.ts.map +1 -0
- package/dist/services/workflow/nodes/loop-until.node.js +281 -0
- package/dist/services/workflow/nodes/loop-until.node.js.map +1 -0
- package/dist/services/workflow/nodes/parallel.node.d.ts.map +1 -1
- package/dist/services/workflow/nodes/parallel.node.js +7 -0
- package/dist/services/workflow/nodes/parallel.node.js.map +1 -1
- package/dist/services/workflow/nodes/sequential.node.d.ts.map +1 -1
- package/dist/services/workflow/nodes/sequential.node.js +7 -0
- package/dist/services/workflow/nodes/sequential.node.js.map +1 -1
- package/dist/services/workflow/nodes/switch.node.d.ts.map +1 -1
- package/dist/services/workflow/nodes/switch.node.js +7 -0
- package/dist/services/workflow/nodes/switch.node.js.map +1 -1
- package/dist/services/workflow/workflow-definition-validator.service.d.ts.map +1 -1
- package/dist/services/workflow/workflow-definition-validator.service.js +5 -2
- package/dist/services/workflow/workflow-definition-validator.service.js.map +1 -1
- package/dist/services/workflow/workflow-expression.service.d.ts.map +1 -1
- package/dist/services/workflow/workflow-expression.service.js +5 -0
- package/dist/services/workflow/workflow-expression.service.js.map +1 -1
- package/dist/services/workflow/workflow-node-registry.service.d.ts +2 -1
- package/dist/services/workflow/workflow-node-registry.service.d.ts.map +1 -1
- package/dist/services/workflow/workflow-node-registry.service.js +7 -0
- package/dist/services/workflow/workflow-node-registry.service.js.map +1 -1
- package/dist/services/workflow/workflow-runtime.service.d.ts +8 -0
- package/dist/services/workflow/workflow-runtime.service.d.ts.map +1 -1
- package/dist/services/workflow/workflow-runtime.service.js +197 -32
- package/dist/services/workflow/workflow-runtime.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +4 -0
- package/dist/solid-core.module.js.map +1 -1
- package/dist/types/workflow-dsl.types.d.ts +14 -0
- package/dist/types/workflow-dsl.types.d.ts.map +1 -1
- package/dist/types/workflow-dsl.types.js.map +1 -1
- package/dist-tests/api/authenticate.spec.js +119 -0
- package/dist-tests/api/authenticate.spec.js.map +1 -0
- package/dist-tests/api/crud-service.findOne.cityMaster.spec.js +97 -0
- package/dist-tests/api/crud-service.findOne.cityMaster.spec.js.map +1 -0
- package/dist-tests/api/ping.spec.js +21 -0
- package/dist-tests/api/ping.spec.js.map +1 -0
- package/dist-tests/helpers/auth.js +41 -0
- package/dist-tests/helpers/auth.js.map +1 -0
- package/dist-tests/helpers/env.js +11 -0
- package/dist-tests/helpers/env.js.map +1 -0
- package/docs/agent-builder/notebook-lm-prompt-for-agent-builder.md +136 -0
- package/docs/agent-builder/team-ready-note-agent-builder.md +305 -0
- package/docs/agent-hub-grooming.md +301 -0
- package/docs/dashboards/AGENTIC_DASHBOARD_IMPLEMENTATION_PLAN.md +438 -0
- package/docs/dashboards/dashboard-curl-smoke-tests.txt +146 -0
- package/docs/dashboards/delete-legacy-dashboard-metadata.sql +172 -0
- package/docs/datasource-introspection-ddl-analysis.md +326 -0
- package/docs/datasource-introspection-implementation-plan.md +306 -0
- package/docs/grouping-enhancements.md +89 -0
- package/docs/java-spring/README.md +3 -0
- package/docs/java-spring/solid-core-module-deep-dive-report.md +1317 -0
- package/docs/module-package-import-handoff.md +691 -0
- package/docs/seed-changes.md +65 -0
- package/docs/test-data-workflow.md +200 -0
- package/docs/type-declaration-import-issue.md +24 -0
- package/docs/workflow/business-automation-example-notes.md +309 -0
- package/docs/workflow/control-flow-node-addition-sop.md +324 -0
- package/docs/workflow/data-engineering-pipeline-example-notes.md +330 -0
- package/docs/workflow/foreach-example-notes.md +187 -0
- package/docs/workflow/hello-world-example-notes.md +271 -0
- package/docs/workflow/kestra-concepts-plugins-blueprints.md +315 -0
- package/docs/workflow/loop-until-example-notes.md +198 -0
- package/docs/workflow/microservices-and-apis-example-notes.md +264 -0
- package/docs/workflow/samples.md +25 -0
- package/docs/workflow/what-is-kestra.md +79 -0
- package/docs/workflow/workflow-core-module-handoff-summary.md +191 -0
- package/docs/workflow/workflow-module-brd.md +185 -0
- package/docs/workflow/workflow-module-domain-model.md +252 -0
- package/docs/workflow/workflow-module-metadata-dsl.md +302 -0
- package/docs/workflow/workflow-module-technical-spec.md +293 -0
- package/docs/workflow/workflow-node-type-contracts.md +635 -0
- package/docs/workflow/workflow-node-ui-metadata-contract.md +1262 -0
- package/docs/workflow/workflow-solidx-model-field-spec.md +284 -0
- package/package.json +1 -1
- package/src/commands/seed.command.ts +19 -0
- package/src/entities/saved-filters.entity.ts +3 -3
- package/src/entities/workflow-trigger-execution.entity.ts +1 -1
- package/src/index.ts +2 -0
- package/src/interfaces.ts +1 -0
- package/src/seeders/module-metadata-seeder.service.ts +50 -36
- package/src/seeders/seed-data/solid-core-metadata.json +80 -67
- package/src/services/workflow/nodes/execution-fail.node.ts +82 -0
- package/src/services/workflow/nodes/for-each.node.ts +140 -6
- package/src/services/workflow/nodes/if.node.ts +7 -0
- package/src/services/workflow/nodes/log-write.node.ts +2 -0
- package/src/services/workflow/nodes/loop-until.node.ts +343 -0
- package/src/services/workflow/nodes/parallel.node.ts +7 -0
- package/src/services/workflow/nodes/sequential.node.ts +7 -0
- package/src/services/workflow/nodes/switch.node.ts +7 -0
- package/src/services/workflow/workflow-definition-validator.service.ts +5 -2
- package/src/services/workflow/workflow-expression.service.ts +5 -0
- package/src/services/workflow/workflow-node-registry.service.ts +11 -0
- package/src/services/workflow/workflow-runtime.service.ts +274 -39
- package/src/solid-core.module.ts +4 -0
- package/src/types/workflow-dsl.types.ts +43 -0
- package/.claude/settings.local.json +0 -16
- package/CLAUDE.md +0 -26
- package/src/services/1.js +0 -6
|
@@ -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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AAsB;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,CAmqBlC","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(definitionDsl.nodes);\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 try {\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 await this.runNodes(definitionDsl.nodes, runtimeContext);\n\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 } catch (error) {\n const failed = await this.writer.failExecution(execution, error);\n\n this.logger.error(\n `Failed workflow execution ${failed.executionIdentifier} for ${definition.key}: ${failed.errorSummary}`,\n error instanceof Error ? error.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(error),\n metadata: {\n executionIdentifier: failed.executionIdentifier,\n durationMs: failed.durationMs,\n },\n }, this.nextLogSequence(runtimeContext));\n\n return this.toResponse(failed);\n }\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 for (const node of nodes ?? []) {\n await this.runNode(node, context);\n }\n\n return context.outputs;\n }\n\n private async runNode(\n node: WorkflowNodeDefinition,\n context: WorkflowRuntimeContext,\n ): Promise<void> {\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;\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] = 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 } 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;\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 throw error;\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 ...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 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":["../../../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,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAGjC,YAEE,aAA6C,EAC5B,QAAqC,EACrC,UAAqC,EACrC,MAAsC,EACtC,SAA6C,EAC7C,qBAA4C,EAC5C,iCAAkF;QANlF,kBAAa,GAAb,aAAa,CAAe;QAC5B,aAAQ,GAAR,QAAQ,CAA6B;QACrC,eAAU,GAAV,UAAU,CAA2B;QACrC,WAAM,GAAN,MAAM,CAAgC;QACtC,cAAS,GAAT,SAAS,CAAoC;QAC7C,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,sCAAiC,GAAjC,iCAAiC,CAAiD;QAVpF,WAAM,GAAG,IAAI,eAAM,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAC;IAW/D,CAAC;IAEJ,KAAK,CAAC,qBAAqB,CACzB,EAAU,EACV,OAAiC;QAEjC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,+CAAkB,EAAE;YACtE,KAAK,EAAE,EAAE,EAAE,EAAS;SACrB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,0BAA0B,CAC9B,EAAU,EACV,UAAoC,EAAE;QAEtC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,+CAAkB,EAAE;YACtE,KAAK,EAAE,EA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,CAAC,KAAK,CAAC;aACzB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,KAAK,KAAK,IAAI,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;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid-core.module.d.ts","sourceRoot":"","sources":["../src/solid-core.module.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,CAAC;AAChB,OAAO,EAAU,kBAAkB,EAAU,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"solid-core.module.d.ts","sourceRoot":"","sources":["../src/solid-core.module.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,CAAC;AAChB,OAAO,EAAU,kBAAkB,EAAU,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAgdhF,qBA8jBa,eAAgB,YAAW,UAAU;IAChD,SAAS,CAAC,QAAQ,EAAE,kBAAkB;CAQvC"}
|
|
@@ -450,10 +450,12 @@ const workflow_invocation_service_1 = require("./services/workflow/workflow-invo
|
|
|
450
450
|
const workflow_node_registry_service_1 = require("./services/workflow/workflow-node-registry.service");
|
|
451
451
|
const workflow_runtime_service_1 = require("./services/workflow/workflow-runtime.service");
|
|
452
452
|
const workflow_scheduled_trigger_job_1 = require("./services/workflow/workflow-scheduled-trigger.job");
|
|
453
|
+
const execution_fail_node_1 = require("./services/workflow/nodes/execution-fail.node");
|
|
453
454
|
const for_each_node_1 = require("./services/workflow/nodes/for-each.node");
|
|
454
455
|
const http_request_node_1 = require("./services/workflow/nodes/http-request.node");
|
|
455
456
|
const if_node_1 = require("./services/workflow/nodes/if.node");
|
|
456
457
|
const log_write_node_1 = require("./services/workflow/nodes/log-write.node");
|
|
458
|
+
const loop_until_node_1 = require("./services/workflow/nodes/loop-until.node");
|
|
457
459
|
const parallel_node_1 = require("./services/workflow/nodes/parallel.node");
|
|
458
460
|
const runtime_python_node_1 = require("./services/workflow/nodes/runtime-python.node");
|
|
459
461
|
const sequential_node_1 = require("./services/workflow/nodes/sequential.node");
|
|
@@ -935,10 +937,12 @@ exports.SolidCoreModule = SolidCoreModule = __decorate([
|
|
|
935
937
|
workflow_definition_validator_service_1.WorkflowDefinitionValidatorService,
|
|
936
938
|
workflow_node_registry_service_1.WorkflowNodeRegistryService,
|
|
937
939
|
workflow_scheduled_trigger_job_1.WorkflowScheduledTriggerJobService,
|
|
940
|
+
execution_fail_node_1.ExecutionFailNode,
|
|
938
941
|
log_write_node_1.LogWriteNode,
|
|
939
942
|
http_request_node_1.HttpRequestNode,
|
|
940
943
|
if_node_1.IfNode,
|
|
941
944
|
for_each_node_1.ForEachNode,
|
|
945
|
+
loop_until_node_1.LoopUntilNode,
|
|
942
946
|
parallel_node_1.ParallelNode,
|
|
943
947
|
runtime_python_node_1.RuntimePythonNode,
|
|
944
948
|
sequential_node_1.SequentialNode,
|