@shipfox/api-workflows 2.0.0
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/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +311 -0
- package/LICENSE +21 -0
- package/dist/core/agent-tool-capability-warning.d.ts +7 -0
- package/dist/core/agent-tool-capability-warning.d.ts.map +1 -0
- package/dist/core/agent-tool-capability-warning.js +149 -0
- package/dist/core/agent-tool-capability-warning.js.map +1 -0
- package/dist/core/agent-tools.d.ts +51 -0
- package/dist/core/agent-tools.d.ts.map +1 -0
- package/dist/core/agent-tools.js +296 -0
- package/dist/core/agent-tools.js.map +1 -0
- package/dist/core/checkout.d.ts +29 -0
- package/dist/core/checkout.d.ts.map +1 -0
- package/dist/core/checkout.js +42 -0
- package/dist/core/checkout.js.map +1 -0
- package/dist/core/condition-trace.d.ts +13 -0
- package/dist/core/condition-trace.d.ts.map +1 -0
- package/dist/core/condition-trace.js +51 -0
- package/dist/core/condition-trace.js.map +1 -0
- package/dist/core/entities/index.d.ts +5 -0
- package/dist/core/entities/index.d.ts.map +1 -0
- package/dist/core/entities/index.js +3 -0
- package/dist/core/entities/index.js.map +1 -0
- package/dist/core/entities/job-execution.d.ts +30 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -0
- package/dist/core/entities/job-execution.js +3 -0
- package/dist/core/entities/job-execution.js.map +1 -0
- package/dist/core/entities/job-listener-event.d.ts +15 -0
- package/dist/core/entities/job-listener-event.d.ts.map +1 -0
- package/dist/core/entities/job-listener-event.js +3 -0
- package/dist/core/entities/job-listener-event.js.map +1 -0
- package/dist/core/entities/job.d.ts +54 -0
- package/dist/core/entities/job.d.ts.map +1 -0
- package/dist/core/entities/job.js +29 -0
- package/dist/core/entities/job.js.map +1 -0
- package/dist/core/entities/step.d.ts +86 -0
- package/dist/core/entities/step.d.ts.map +1 -0
- package/dist/core/entities/step.js +12 -0
- package/dist/core/entities/step.js.map +1 -0
- package/dist/core/entities/workflow-run-attempt.d.ts +20 -0
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
- package/dist/core/entities/workflow-run-attempt.js +3 -0
- package/dist/core/entities/workflow-run-attempt.js.map +1 -0
- package/dist/core/entities/workflow-run.d.ts +66 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -0
- package/dist/core/entities/workflow-run.js +10 -0
- package/dist/core/entities/workflow-run.js.map +1 -0
- package/dist/core/errors.d.ts +85 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +134 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/job-execution-outcome.d.ts +29 -0
- package/dist/core/job-execution-outcome.d.ts.map +1 -0
- package/dist/core/job-execution-outcome.js +31 -0
- package/dist/core/job-execution-outcome.js.map +1 -0
- package/dist/core/job-execution.d.ts +37 -0
- package/dist/core/job-execution.d.ts.map +1 -0
- package/dist/core/job-execution.js +425 -0
- package/dist/core/job-execution.js.map +1 -0
- package/dist/core/job-transition/decide-job-activation.d.ts +29 -0
- package/dist/core/job-transition/decide-job-activation.d.ts.map +1 -0
- package/dist/core/job-transition/decide-job-activation.js +51 -0
- package/dist/core/job-transition/decide-job-activation.js.map +1 -0
- package/dist/core/job-transition/derive-job-execution-outputs.d.ts +18 -0
- package/dist/core/job-transition/derive-job-execution-outputs.d.ts.map +1 -0
- package/dist/core/job-transition/derive-job-execution-outputs.js +23 -0
- package/dist/core/job-transition/derive-job-execution-outputs.js.map +1 -0
- package/dist/core/job-transition/derive-job-success.d.ts +16 -0
- package/dist/core/job-transition/derive-job-success.d.ts.map +1 -0
- package/dist/core/job-transition/derive-job-success.js +47 -0
- package/dist/core/job-transition/derive-job-success.js.map +1 -0
- package/dist/core/job-transition/index.d.ts +5 -0
- package/dist/core/job-transition/index.d.ts.map +1 -0
- package/dist/core/job-transition/index.js +6 -0
- package/dist/core/job-transition/index.js.map +1 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.d.ts +4 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.d.ts.map +1 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.js +8 -0
- package/dist/core/job-transition/runtime-completion-status-for-job.js.map +1 -0
- package/dist/core/listener-execution-materialization.d.ts +30 -0
- package/dist/core/listener-execution-materialization.d.ts.map +1 -0
- package/dist/core/listener-execution-materialization.js +87 -0
- package/dist/core/listener-execution-materialization.js.map +1 -0
- package/dist/core/run-workflow.d.ts +11 -0
- package/dist/core/run-workflow.d.ts.map +1 -0
- package/dist/core/run-workflow.js +28 -0
- package/dist/core/run-workflow.js.map +1 -0
- package/dist/core/source-control.d.ts +5 -0
- package/dist/core/source-control.d.ts.map +1 -0
- package/dist/core/source-control.js +19 -0
- package/dist/core/source-control.js.map +1 -0
- package/dist/core/step-config/agent.d.ts +49 -0
- package/dist/core/step-config/agent.d.ts.map +1 -0
- package/dist/core/step-config/agent.js +337 -0
- package/dist/core/step-config/agent.js.map +1 -0
- package/dist/core/step-config/assemble-run-context.d.ts +94 -0
- package/dist/core/step-config/assemble-run-context.d.ts.map +1 -0
- package/dist/core/step-config/assemble-run-context.js +393 -0
- package/dist/core/step-config/assemble-run-context.js.map +1 -0
- package/dist/core/step-config/complete-step-dispatch-config.d.ts +13 -0
- package/dist/core/step-config/complete-step-dispatch-config.d.ts.map +1 -0
- package/dist/core/step-config/complete-step-dispatch-config.js +38 -0
- package/dist/core/step-config/complete-step-dispatch-config.js.map +1 -0
- package/dist/core/step-config/fields.d.ts +38 -0
- package/dist/core/step-config/fields.d.ts.map +1 -0
- package/dist/core/step-config/fields.js +72 -0
- package/dist/core/step-config/fields.js.map +1 -0
- package/dist/core/step-config/index.d.ts +8 -0
- package/dist/core/step-config/index.d.ts.map +1 -0
- package/dist/core/step-config/index.js +7 -0
- package/dist/core/step-config/index.js.map +1 -0
- package/dist/core/step-config/materialize-job-execution-steps.d.ts +35 -0
- package/dist/core/step-config/materialize-job-execution-steps.d.ts.map +1 -0
- package/dist/core/step-config/materialize-job-execution-steps.js +92 -0
- package/dist/core/step-config/materialize-job-execution-steps.js.map +1 -0
- package/dist/core/step-config/materialize-workflow-model.d.ts +42 -0
- package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -0
- package/dist/core/step-config/materialize-workflow-model.js +96 -0
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -0
- package/dist/core/step-config/resolve-job-execution-name.d.ts +18 -0
- package/dist/core/step-config/resolve-job-execution-name.d.ts.map +1 -0
- package/dist/core/step-config/resolve-job-execution-name.js +36 -0
- package/dist/core/step-config/resolve-job-execution-name.js.map +1 -0
- package/dist/core/step-config/resolve-step-config.d.ts +33 -0
- package/dist/core/step-config/resolve-step-config.d.ts.map +1 -0
- package/dist/core/step-config/resolve-step-config.js +164 -0
- package/dist/core/step-config/resolve-step-config.js.map +1 -0
- package/dist/core/step-config/run.d.ts +39 -0
- package/dist/core/step-config/run.d.ts.map +1 -0
- package/dist/core/step-config/run.js +360 -0
- package/dist/core/step-config/run.js.map +1 -0
- package/dist/core/step-config/workflow-evaluation-context.d.ts +6 -0
- package/dist/core/step-config/workflow-evaluation-context.d.ts.map +1 -0
- package/dist/core/step-config/workflow-evaluation-context.js +3 -0
- package/dist/core/step-config/workflow-evaluation-context.js.map +1 -0
- package/dist/core/step-transition/apply-step-transition.d.ts +26 -0
- package/dist/core/step-transition/apply-step-transition.d.ts.map +1 -0
- package/dist/core/step-transition/apply-step-transition.js +141 -0
- package/dist/core/step-transition/apply-step-transition.js.map +1 -0
- package/dist/core/step-transition/decide-step-transition.d.ts +71 -0
- package/dist/core/step-transition/decide-step-transition.d.ts.map +1 -0
- package/dist/core/step-transition/decide-step-transition.js +110 -0
- package/dist/core/step-transition/decide-step-transition.js.map +1 -0
- package/dist/core/step-transition/evaluate-gate.d.ts +28 -0
- package/dist/core/step-transition/evaluate-gate.d.ts.map +1 -0
- package/dist/core/step-transition/evaluate-gate.js +159 -0
- package/dist/core/step-transition/evaluate-gate.js.map +1 -0
- package/dist/core/step-transition/read-step-outputs.d.ts +3 -0
- package/dist/core/step-transition/read-step-outputs.d.ts.map +1 -0
- package/dist/core/step-transition/read-step-outputs.js +24 -0
- package/dist/core/step-transition/read-step-outputs.js.map +1 -0
- package/dist/core/workflow-run-creation.d.ts +43 -0
- package/dist/core/workflow-run-creation.d.ts.map +1 -0
- package/dist/core/workflow-run-creation.js +80 -0
- package/dist/core/workflow-run-creation.js.map +1 -0
- package/dist/core/workflow-scheduling/index.d.ts +5 -0
- package/dist/core/workflow-scheduling/index.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/index.js +4 -0
- package/dist/core/workflow-scheduling/index.js.map +1 -0
- package/dist/core/workflow-scheduling/run-progress.d.ts +20 -0
- package/dist/core/workflow-scheduling/run-progress.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/run-progress.js +40 -0
- package/dist/core/workflow-scheduling/run-progress.js.map +1 -0
- package/dist/core/workflow-scheduling/runtime-dag.d.ts +10 -0
- package/dist/core/workflow-scheduling/runtime-dag.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/runtime-dag.js +3 -0
- package/dist/core/workflow-scheduling/runtime-dag.js.map +1 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.d.ts +16 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.js +3 -0
- package/dist/core/workflow-scheduling/runtime-scheduling-command.js.map +1 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.d.ts +9 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.d.ts.map +1 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.js +72 -0
- package/dist/core/workflow-scheduling/schedule-runtime-dag.js.map +1 -0
- package/dist/db/db.d.ts +4959 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +37 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/index.d.ts +9 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +10 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/job-listener-events.d.ts +18 -0
- package/dist/db/job-listener-events.d.ts.map +1 -0
- package/dist/db/job-listener-events.js +59 -0
- package/dist/db/job-listener-events.js.map +1 -0
- package/dist/db/job-listeners.d.ts +55 -0
- package/dist/db/job-listeners.d.ts.map +1 -0
- package/dist/db/job-listeners.js +358 -0
- package/dist/db/job-listeners.js.map +1 -0
- package/dist/db/outbox-writes.d.ts +12 -0
- package/dist/db/outbox-writes.d.ts.map +1 -0
- package/dist/db/outbox-writes.js +20 -0
- package/dist/db/outbox-writes.js.map +1 -0
- package/dist/db/runner-lease-table.d.ts +469 -0
- package/dist/db/runner-lease-table.d.ts.map +1 -0
- package/dist/db/runner-lease-table.js +42 -0
- package/dist/db/runner-lease-table.js.map +1 -0
- package/dist/db/schema/common.d.ts +2 -0
- package/dist/db/schema/common.d.ts.map +1 -0
- package/dist/db/schema/common.js +4 -0
- package/dist/db/schema/common.js.map +1 -0
- package/dist/db/schema/job-executions.d.ts +311 -0
- package/dist/db/schema/job-executions.d.ts.map +1 -0
- package/dist/db/schema/job-executions.js +76 -0
- package/dist/db/schema/job-executions.js.map +1 -0
- package/dist/db/schema/job-listener-events.d.ts +200 -0
- package/dist/db/schema/job-listener-events.d.ts.map +1 -0
- package/dist/db/schema/job-listener-events.js +50 -0
- package/dist/db/schema/job-listener-events.js.map +1 -0
- package/dist/db/schema/jobs.d.ts +542 -0
- package/dist/db/schema/jobs.d.ts.map +1 -0
- package/dist/db/schema/jobs.js +121 -0
- package/dist/db/schema/jobs.js.map +1 -0
- package/dist/db/schema/outbox.d.ts +195 -0
- package/dist/db/schema/outbox.d.ts.map +1 -0
- package/dist/db/schema/outbox.js +5 -0
- package/dist/db/schema/outbox.js.map +1 -0
- package/dist/db/schema/step-attempts.d.ts +330 -0
- package/dist/db/schema/step-attempts.d.ts.map +1 -0
- package/dist/db/schema/step-attempts.js +80 -0
- package/dist/db/schema/step-attempts.js.map +1 -0
- package/dist/db/schema/steps.d.ts +352 -0
- package/dist/db/schema/steps.d.ts.map +1 -0
- package/dist/db/schema/steps.js +80 -0
- package/dist/db/schema/steps.js.map +1 -0
- package/dist/db/schema/workflow-run-attempts.d.ts +239 -0
- package/dist/db/schema/workflow-run-attempts.d.ts.map +1 -0
- package/dist/db/schema/workflow-run-attempts.js +53 -0
- package/dist/db/schema/workflow-run-attempts.js.map +1 -0
- package/dist/db/schema/workflow-runs.d.ts +360 -0
- package/dist/db/schema/workflow-runs.d.ts.map +1 -0
- package/dist/db/schema/workflow-runs.js +85 -0
- package/dist/db/schema/workflow-runs.js.map +1 -0
- package/dist/db/workflow-runs/job-executions.d.ts +49 -0
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -0
- package/dist/db/workflow-runs/job-executions.js +271 -0
- package/dist/db/workflow-runs/job-executions.js.map +1 -0
- package/dist/db/workflow-runs/jobs.d.ts +60 -0
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -0
- package/dist/db/workflow-runs/jobs.js +288 -0
- package/dist/db/workflow-runs/jobs.js.map +1 -0
- package/dist/db/workflow-runs/outbox.d.ts +20 -0
- package/dist/db/workflow-runs/outbox.d.ts.map +1 -0
- package/dist/db/workflow-runs/outbox.js +68 -0
- package/dist/db/workflow-runs/outbox.js.map +1 -0
- package/dist/db/workflow-runs/queries.d.ts +71 -0
- package/dist/db/workflow-runs/queries.d.ts.map +1 -0
- package/dist/db/workflow-runs/queries.js +253 -0
- package/dist/db/workflow-runs/queries.js.map +1 -0
- package/dist/db/workflow-runs/run-create.d.ts +32 -0
- package/dist/db/workflow-runs/run-create.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-create.js +288 -0
- package/dist/db/workflow-runs/run-create.js.map +1 -0
- package/dist/db/workflow-runs/run-graph.d.ts +27 -0
- package/dist/db/workflow-runs/run-graph.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-graph.js +63 -0
- package/dist/db/workflow-runs/run-graph.js.map +1 -0
- package/dist/db/workflow-runs/run-rerun.d.ts +8 -0
- package/dist/db/workflow-runs/run-rerun.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-rerun.js +207 -0
- package/dist/db/workflow-runs/run-rerun.js.map +1 -0
- package/dist/db/workflow-runs/run-status.d.ts +24 -0
- package/dist/db/workflow-runs/run-status.d.ts.map +1 -0
- package/dist/db/workflow-runs/run-status.js +249 -0
- package/dist/db/workflow-runs/run-status.js.map +1 -0
- package/dist/db/workflow-runs/runs.d.ts +7 -0
- package/dist/db/workflow-runs/runs.d.ts.map +1 -0
- package/dist/db/workflow-runs/runs.js +5 -0
- package/dist/db/workflow-runs/runs.js.map +1 -0
- package/dist/db/workflow-runs/shared.d.ts +24 -0
- package/dist/db/workflow-runs/shared.d.ts.map +1 -0
- package/dist/db/workflow-runs/shared.js +50 -0
- package/dist/db/workflow-runs/shared.js.map +1 -0
- package/dist/db/workflow-runs/steps.d.ts +83 -0
- package/dist/db/workflow-runs/steps.d.ts.map +1 -0
- package/dist/db/workflow-runs/steps.js +246 -0
- package/dist/db/workflow-runs/steps.js.map +1 -0
- package/dist/db/workflow-runs.d.ts +12 -0
- package/dist/db/workflow-runs.d.ts.map +1 -0
- package/dist/db/workflow-runs.js +8 -0
- package/dist/db/workflow-runs.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +3 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/instance.d.ts +20 -0
- package/dist/metrics/instance.d.ts.map +1 -0
- package/dist/metrics/instance.js +127 -0
- package/dist/metrics/instance.js.map +1 -0
- package/dist/metrics/service.d.ts +2 -0
- package/dist/metrics/service.d.ts.map +1 -0
- package/dist/metrics/service.js +30 -0
- package/dist/metrics/service.js.map +1 -0
- package/dist/presentation/dto/checkout-token.d.ts +6 -0
- package/dist/presentation/dto/checkout-token.d.ts.map +1 -0
- package/dist/presentation/dto/checkout-token.js +74 -0
- package/dist/presentation/dto/checkout-token.js.map +1 -0
- package/dist/presentation/dto/index.d.ts +4 -0
- package/dist/presentation/dto/index.d.ts.map +1 -0
- package/dist/presentation/dto/index.js +5 -0
- package/dist/presentation/dto/index.js.map +1 -0
- package/dist/presentation/dto/job.d.ts +6 -0
- package/dist/presentation/dto/job.d.ts.map +1 -0
- package/dist/presentation/dto/job.js +59 -0
- package/dist/presentation/dto/job.js.map +1 -0
- package/dist/presentation/dto/step.d.ts +6 -0
- package/dist/presentation/dto/step.d.ts.map +1 -0
- package/dist/presentation/dto/step.js +162 -0
- package/dist/presentation/dto/step.js.map +1 -0
- package/dist/presentation/dto/workflow-run.d.ts +6 -0
- package/dist/presentation/dto/workflow-run.d.ts.map +1 -0
- package/dist/presentation/dto/workflow-run.js +35 -0
- package/dist/presentation/dto/workflow-run.js.map +1 -0
- package/dist/presentation/index.d.ts +3 -0
- package/dist/presentation/index.d.ts.map +1 -0
- package/dist/presentation/index.js +4 -0
- package/dist/presentation/index.js.map +1 -0
- package/dist/presentation/routes/agent-runtime-config.d.ts +2 -0
- package/dist/presentation/routes/agent-runtime-config.d.ts.map +1 -0
- package/dist/presentation/routes/agent-runtime-config.js +71 -0
- package/dist/presentation/routes/agent-runtime-config.js.map +1 -0
- package/dist/presentation/routes/cancel-run.d.ts +2 -0
- package/dist/presentation/routes/cancel-run.d.ts.map +1 -0
- package/dist/presentation/routes/cancel-run.js +46 -0
- package/dist/presentation/routes/cancel-run.js.map +1 -0
- package/dist/presentation/routes/checkout-token.d.ts +2 -0
- package/dist/presentation/routes/checkout-token.d.ts.map +1 -0
- package/dist/presentation/routes/checkout-token.js +64 -0
- package/dist/presentation/routes/checkout-token.js.map +1 -0
- package/dist/presentation/routes/get-run-aggregates.d.ts +2 -0
- package/dist/presentation/routes/get-run-aggregates.d.ts.map +1 -0
- package/dist/presentation/routes/get-run-aggregates.js +60 -0
- package/dist/presentation/routes/get-run-aggregates.js.map +1 -0
- package/dist/presentation/routes/get-run.d.ts +2 -0
- package/dist/presentation/routes/get-run.d.ts.map +1 -0
- package/dist/presentation/routes/get-run.js +60 -0
- package/dist/presentation/routes/get-run.js.map +1 -0
- package/dist/presentation/routes/get-step-secrets.d.ts +2 -0
- package/dist/presentation/routes/get-step-secrets.d.ts.map +1 -0
- package/dist/presentation/routes/get-step-secrets.js +115 -0
- package/dist/presentation/routes/get-step-secrets.js.map +1 -0
- package/dist/presentation/routes/index.d.ts +4 -0
- package/dist/presentation/routes/index.d.ts.map +1 -0
- package/dist/presentation/routes/index.js +41 -0
- package/dist/presentation/routes/index.js.map +1 -0
- package/dist/presentation/routes/leased-step.d.ts +14 -0
- package/dist/presentation/routes/leased-step.d.ts.map +1 -0
- package/dist/presentation/routes/leased-step.js +50 -0
- package/dist/presentation/routes/leased-step.js.map +1 -0
- package/dist/presentation/routes/list-run-attempts.d.ts +2 -0
- package/dist/presentation/routes/list-run-attempts.d.ts.map +1 -0
- package/dist/presentation/routes/list-run-attempts.js +35 -0
- package/dist/presentation/routes/list-run-attempts.js.map +1 -0
- package/dist/presentation/routes/list-runs.d.ts +2 -0
- package/dist/presentation/routes/list-runs.d.ts.map +1 -0
- package/dist/presentation/routes/list-runs.js +70 -0
- package/dist/presentation/routes/list-runs.js.map +1 -0
- package/dist/presentation/routes/next-step.d.ts +2 -0
- package/dist/presentation/routes/next-step.d.ts.map +1 -0
- package/dist/presentation/routes/next-step.js +65 -0
- package/dist/presentation/routes/next-step.js.map +1 -0
- package/dist/presentation/routes/report-step.d.ts +2 -0
- package/dist/presentation/routes/report-step.d.ts.map +1 -0
- package/dist/presentation/routes/report-step.js +73 -0
- package/dist/presentation/routes/report-step.js.map +1 -0
- package/dist/presentation/routes/require-accessible-run.d.ts +7 -0
- package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -0
- package/dist/presentation/routes/require-accessible-run.js +25 -0
- package/dist/presentation/routes/require-accessible-run.js.map +1 -0
- package/dist/presentation/routes/rerun-run.d.ts +2 -0
- package/dist/presentation/routes/rerun-run.d.ts.map +1 -0
- package/dist/presentation/routes/rerun-run.js +56 -0
- package/dist/presentation/routes/rerun-run.js.map +1 -0
- package/dist/presentation/subscribers/index.d.ts +8 -0
- package/dist/presentation/subscribers/index.d.ts.map +1 -0
- package/dist/presentation/subscribers/index.js +9 -0
- package/dist/presentation/subscribers/index.js.map +1 -0
- package/dist/presentation/subscribers/on-job-event-delivered.d.ts +3 -0
- package/dist/presentation/subscribers/on-job-event-delivered.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-job-event-delivered.js +24 -0
- package/dist/presentation/subscribers/on-job-event-delivered.js.map +1 -0
- package/dist/presentation/subscribers/on-job-steps-settled.d.ts +3 -0
- package/dist/presentation/subscribers/on-job-steps-settled.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-job-steps-settled.js +36 -0
- package/dist/presentation/subscribers/on-job-steps-settled.js.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.d.ts +3 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.js +20 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.js.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.d.ts +3 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.js +35 -0
- package/dist/presentation/subscribers/on-runner-job-lease-expired.js.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-queued.d.ts +3 -0
- package/dist/presentation/subscribers/on-runner-job-queued.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-runner-job-queued.js +20 -0
- package/dist/presentation/subscribers/on-runner-job-queued.js.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.d.ts +3 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.js +35 -0
- package/dist/presentation/subscribers/on-workflow-run-attempt-created.js.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.d.ts +3 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.js +25 -0
- package/dist/presentation/subscribers/on-workflow-run-cancelled.js.map +1 -0
- package/dist/temporal/activities/index.d.ts +23 -0
- package/dist/temporal/activities/index.d.ts.map +1 -0
- package/dist/temporal/activities/index.js +26 -0
- package/dist/temporal/activities/index.js.map +1 -0
- package/dist/temporal/activities/orchestration-activities.d.ts +130 -0
- package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -0
- package/dist/temporal/activities/orchestration-activities.js +188 -0
- package/dist/temporal/activities/orchestration-activities.js.map +1 -0
- package/dist/temporal/constants.d.ts +7 -0
- package/dist/temporal/constants.d.ts.map +1 -0
- package/dist/temporal/constants.js +8 -0
- package/dist/temporal/constants.js.map +1 -0
- package/dist/temporal/index.d.ts +3 -0
- package/dist/temporal/index.d.ts.map +1 -0
- package/dist/temporal/index.js +4 -0
- package/dist/temporal/index.js.map +1 -0
- package/dist/temporal/workflow-not-found.d.ts +2 -0
- package/dist/temporal/workflow-not-found.d.ts.map +1 -0
- package/dist/temporal/workflow-not-found.js +10 -0
- package/dist/temporal/workflow-not-found.js.map +1 -0
- package/dist/temporal/workflows/deadline.d.ts +3 -0
- package/dist/temporal/workflows/deadline.d.ts.map +1 -0
- package/dist/temporal/workflows/deadline.js +8 -0
- package/dist/temporal/workflows/deadline.js.map +1 -0
- package/dist/temporal/workflows/index.d.ts +4 -0
- package/dist/temporal/workflows/index.d.ts.map +1 -0
- package/dist/temporal/workflows/index.js +5 -0
- package/dist/temporal/workflows/index.js.map +1 -0
- package/dist/temporal/workflows/job-execution-orchestration.d.ts +27 -0
- package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -0
- package/dist/temporal/workflows/job-execution-orchestration.js +265 -0
- package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -0
- package/dist/temporal/workflows/job-listener-orchestration.d.ts +40 -0
- package/dist/temporal/workflows/job-listener-orchestration.d.ts.map +1 -0
- package/dist/temporal/workflows/job-listener-orchestration.js +332 -0
- package/dist/temporal/workflows/job-listener-orchestration.js.map +1 -0
- package/dist/temporal/workflows/run-orchestration.d.ts +8 -0
- package/dist/temporal/workflows/run-orchestration.d.ts.map +1 -0
- package/dist/temporal/workflows/run-orchestration.js +243 -0
- package/dist/temporal/workflows/run-orchestration.js.map +1 -0
- package/dist/temporal/workflows/test-env.d.ts +114 -0
- package/dist/temporal/workflows/test-env.d.ts.map +1 -0
- package/dist/temporal/workflows/test-env.js +323 -0
- package/dist/temporal/workflows/test-env.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/drizzle/0000_initial.sql +211 -0
- package/drizzle/0001_agent_tool_materialization.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +1613 -0
- package/drizzle/meta/_journal.json +20 -0
- package/drizzle.config.ts +7 -0
- package/package.json +91 -0
- package/src/core/README.md +79 -0
- package/src/core/agent-tool-capability-warning.test.ts +280 -0
- package/src/core/agent-tool-capability-warning.ts +200 -0
- package/src/core/agent-tools.ts +422 -0
- package/src/core/checkout.test.ts +112 -0
- package/src/core/checkout.ts +63 -0
- package/src/core/condition-trace.ts +64 -0
- package/src/core/entities/index.ts +9 -0
- package/src/core/entities/job-execution.ts +32 -0
- package/src/core/entities/job-listener-event.ts +15 -0
- package/src/core/entities/job.ts +91 -0
- package/src/core/entities/step.ts +126 -0
- package/src/core/entities/workflow-run-attempt.ts +21 -0
- package/src/core/entities/workflow-run.ts +94 -0
- package/src/core/errors.test.ts +45 -0
- package/src/core/errors.ts +209 -0
- package/src/core/index.ts +54 -0
- package/src/core/job-execution-outcome.ts +64 -0
- package/src/core/job-execution.test.ts +1560 -0
- package/src/core/job-execution.ts +581 -0
- package/src/core/job-transition/decide-job-activation.test.ts +196 -0
- package/src/core/job-transition/decide-job-activation.ts +79 -0
- package/src/core/job-transition/derive-job-execution-outputs.ts +41 -0
- package/src/core/job-transition/derive-job-success.test.ts +133 -0
- package/src/core/job-transition/derive-job-success.ts +67 -0
- package/src/core/job-transition/index.ts +11 -0
- package/src/core/job-transition/runtime-completion-status-for-job.ts +14 -0
- package/src/core/listener-execution-materialization.test.ts +49 -0
- package/src/core/listener-execution-materialization.ts +162 -0
- package/src/core/run-workflow.test.ts +229 -0
- package/src/core/run-workflow.ts +41 -0
- package/src/core/source-control.test.ts +17 -0
- package/src/core/source-control.ts +22 -0
- package/src/core/step-config/agent.ts +459 -0
- package/src/core/step-config/assemble-run-context.test.ts +1021 -0
- package/src/core/step-config/assemble-run-context.ts +535 -0
- package/src/core/step-config/complete-step-dispatch-config.test.ts +354 -0
- package/src/core/step-config/complete-step-dispatch-config.ts +40 -0
- package/src/core/step-config/fields.ts +111 -0
- package/src/core/step-config/index.ts +41 -0
- package/src/core/step-config/materialize-job-execution-steps.test.ts +494 -0
- package/src/core/step-config/materialize-job-execution-steps.ts +136 -0
- package/src/core/step-config/materialize-workflow-model.test.ts +1214 -0
- package/src/core/step-config/materialize-workflow-model.ts +140 -0
- package/src/core/step-config/resolve-job-execution-name.test.ts +94 -0
- package/src/core/step-config/resolve-job-execution-name.ts +51 -0
- package/src/core/step-config/resolve-step-config.ts +199 -0
- package/src/core/step-config/run.ts +467 -0
- package/src/core/step-config/workflow-evaluation-context.ts +6 -0
- package/src/core/step-transition/apply-step-transition.ts +163 -0
- package/src/core/step-transition/decide-step-transition.test.ts +307 -0
- package/src/core/step-transition/decide-step-transition.ts +200 -0
- package/src/core/step-transition/evaluate-gate.test.ts +317 -0
- package/src/core/step-transition/evaluate-gate.ts +168 -0
- package/src/core/step-transition/read-step-outputs.ts +27 -0
- package/src/core/workflow-run-creation.test.ts +155 -0
- package/src/core/workflow-run-creation.ts +131 -0
- package/src/core/workflow-scheduling/index.ts +15 -0
- package/src/core/workflow-scheduling/run-progress.test.ts +46 -0
- package/src/core/workflow-scheduling/run-progress.ts +68 -0
- package/src/core/workflow-scheduling/runtime-dag.ts +10 -0
- package/src/core/workflow-scheduling/runtime-scheduling-command.ts +20 -0
- package/src/core/workflow-scheduling/schedule-runtime-dag.test.ts +197 -0
- package/src/core/workflow-scheduling/schedule-runtime-dag.ts +115 -0
- package/src/db/db.ts +40 -0
- package/src/db/index.ts +86 -0
- package/src/db/job-listener-events.test.ts +113 -0
- package/src/db/job-listener-events.ts +73 -0
- package/src/db/job-listeners.test.ts +865 -0
- package/src/db/job-listeners.ts +564 -0
- package/src/db/outbox-writes.ts +40 -0
- package/src/db/rerun-listener.test.ts +64 -0
- package/src/db/run-timeout.test.ts +102 -0
- package/src/db/runner-lease-table.ts +39 -0
- package/src/db/schema/common.ts +3 -0
- package/src/db/schema/job-executions.ts +85 -0
- package/src/db/schema/job-listener-events.ts +58 -0
- package/src/db/schema/jobs.ts +136 -0
- package/src/db/schema/outbox.ts +4 -0
- package/src/db/schema/step-attempts.ts +99 -0
- package/src/db/schema/steps.ts +99 -0
- package/src/db/schema/workflow-run-attempts.ts +59 -0
- package/src/db/schema/workflow-runs.ts +112 -0
- package/src/db/workflow-runs/job-executions.test.ts +99 -0
- package/src/db/workflow-runs/job-executions.ts +421 -0
- package/src/db/workflow-runs/job-status.test.ts +532 -0
- package/src/db/workflow-runs/jobs.test.ts +194 -0
- package/src/db/workflow-runs/jobs.ts +418 -0
- package/src/db/workflow-runs/outbox.ts +109 -0
- package/src/db/workflow-runs/queries.test.ts +256 -0
- package/src/db/workflow-runs/queries.ts +437 -0
- package/src/db/workflow-runs/run-create.test.ts +1281 -0
- package/src/db/workflow-runs/run-create.ts +373 -0
- package/src/db/workflow-runs/run-graph.ts +95 -0
- package/src/db/workflow-runs/run-rerun.test.ts +625 -0
- package/src/db/workflow-runs/run-rerun.ts +266 -0
- package/src/db/workflow-runs/run-status.test.ts +425 -0
- package/src/db/workflow-runs/run-status.ts +391 -0
- package/src/db/workflow-runs/runs.ts +17 -0
- package/src/db/workflow-runs/shared.ts +84 -0
- package/src/db/workflow-runs/steps.test.ts +191 -0
- package/src/db/workflow-runs/steps.ts +476 -0
- package/src/db/workflow-runs.ts +111 -0
- package/src/index.ts +99 -0
- package/src/metrics/index.ts +1 -0
- package/src/metrics/instance.ts +160 -0
- package/src/metrics/service.ts +30 -0
- package/src/presentation/dto/checkout-token.test.ts +107 -0
- package/src/presentation/dto/checkout-token.ts +85 -0
- package/src/presentation/dto/index.ts +3 -0
- package/src/presentation/dto/job.test.ts +108 -0
- package/src/presentation/dto/job.ts +64 -0
- package/src/presentation/dto/step.test.ts +307 -0
- package/src/presentation/dto/step.ts +145 -0
- package/src/presentation/dto/workflow-run.ts +38 -0
- package/src/presentation/index.ts +10 -0
- package/src/presentation/routes/agent-runtime-config.test.ts +478 -0
- package/src/presentation/routes/agent-runtime-config.ts +81 -0
- package/src/presentation/routes/cancel-run.test.ts +156 -0
- package/src/presentation/routes/cancel-run.ts +37 -0
- package/src/presentation/routes/checkout-token.test.ts +366 -0
- package/src/presentation/routes/checkout-token.ts +61 -0
- package/src/presentation/routes/get-run-aggregates.test.ts +114 -0
- package/src/presentation/routes/get-run-aggregates.ts +69 -0
- package/src/presentation/routes/get-run.test.ts +604 -0
- package/src/presentation/routes/get-run.ts +66 -0
- package/src/presentation/routes/get-step-secrets.test.ts +260 -0
- package/src/presentation/routes/get-step-secrets.ts +117 -0
- package/src/presentation/routes/index.test.ts +71 -0
- package/src/presentation/routes/index.ts +42 -0
- package/src/presentation/routes/leased-step.ts +54 -0
- package/src/presentation/routes/list-run-attempts.test.ts +163 -0
- package/src/presentation/routes/list-run-attempts.ts +27 -0
- package/src/presentation/routes/list-runs.test.ts +244 -0
- package/src/presentation/routes/list-runs.ts +83 -0
- package/src/presentation/routes/next-step.test.ts +366 -0
- package/src/presentation/routes/next-step.ts +62 -0
- package/src/presentation/routes/report-step.test.ts +374 -0
- package/src/presentation/routes/report-step.ts +61 -0
- package/src/presentation/routes/require-accessible-run.ts +27 -0
- package/src/presentation/routes/rerun-run.test.ts +202 -0
- package/src/presentation/routes/rerun-run.ts +48 -0
- package/src/presentation/subscribers/index.ts +7 -0
- package/src/presentation/subscribers/on-job-event-delivered.test.ts +71 -0
- package/src/presentation/subscribers/on-job-event-delivered.ts +30 -0
- package/src/presentation/subscribers/on-job-steps-settled.test.ts +75 -0
- package/src/presentation/subscribers/on-job-steps-settled.ts +42 -0
- package/src/presentation/subscribers/on-runner-job-claimed.test.ts +57 -0
- package/src/presentation/subscribers/on-runner-job-claimed.ts +23 -0
- package/src/presentation/subscribers/on-runner-job-lease-expired.test.ts +73 -0
- package/src/presentation/subscribers/on-runner-job-lease-expired.ts +36 -0
- package/src/presentation/subscribers/on-runner-job-queued.test.ts +57 -0
- package/src/presentation/subscribers/on-runner-job-queued.ts +23 -0
- package/src/presentation/subscribers/on-workflow-run-attempt-created.test.ts +69 -0
- package/src/presentation/subscribers/on-workflow-run-attempt-created.ts +40 -0
- package/src/presentation/subscribers/on-workflow-run-cancelled.test.ts +59 -0
- package/src/presentation/subscribers/on-workflow-run-cancelled.ts +29 -0
- package/src/temporal/activities/index.ts +45 -0
- package/src/temporal/activities/orchestration-activities.test.ts +115 -0
- package/src/temporal/activities/orchestration-activities.ts +305 -0
- package/src/temporal/constants.ts +6 -0
- package/src/temporal/index.ts +6 -0
- package/src/temporal/workflow-not-found.ts +9 -0
- package/src/temporal/workflows/deadline.ts +7 -0
- package/src/temporal/workflows/index.ts +11 -0
- package/src/temporal/workflows/job-execution-orchestration-timeout.test.ts +165 -0
- package/src/temporal/workflows/job-execution-orchestration.test.ts +311 -0
- package/src/temporal/workflows/job-execution-orchestration.ts +314 -0
- package/src/temporal/workflows/job-listener-orchestration-continuation.test.ts +93 -0
- package/src/temporal/workflows/job-listener-orchestration.test.ts +406 -0
- package/src/temporal/workflows/job-listener-orchestration.ts +490 -0
- package/src/temporal/workflows/run-orchestration.test.ts +409 -0
- package/src/temporal/workflows/run-orchestration.ts +283 -0
- package/src/temporal/workflows/test-env.ts +409 -0
- package/test/env.ts +11 -0
- package/test/factories/job.ts +83 -0
- package/test/factories/project.ts +16 -0
- package/test/factories/workflow-model.test.ts +26 -0
- package/test/factories/workflow-model.ts +268 -0
- package/test/factories/workflow-run.ts +58 -0
- package/test/fixtures/active-lease-token.ts +85 -0
- package/test/fixtures/job-with-steps.ts +42 -0
- package/test/fixtures/lease-token.ts +44 -0
- package/test/fixtures/strip-setup-step.ts +23 -0
- package/test/globalSetup.ts +54 -0
- package/test/helpers/workflow-runs.ts +210 -0
- package/test/index.ts +3 -0
- package/test/setup.ts +17 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { WORKFLOWS_WORKFLOW_RUN_CANCELLED, WORKFLOWS_WORKFLOW_RUN_TERMINATED } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import { and, asc, eq, inArray, notInArray, sql } from 'drizzle-orm';
|
|
3
|
+
import { isJobTerminal } from '#core/entities/job.js';
|
|
4
|
+
import { isWorkflowRunTerminal } from '#core/entities/workflow-run.js';
|
|
5
|
+
import { WorkflowRunNotCancellableError, WorkflowRunNotFoundError } from '#core/errors.js';
|
|
6
|
+
import { recordWorkflowJobStatusChanged, recordWorkflowRunStatusChanged } from '#metrics/instance.js';
|
|
7
|
+
import { db } from '../db.js';
|
|
8
|
+
import { writeWorkflowsOutboxEvent } from '../outbox-writes.js';
|
|
9
|
+
import { jobExecutions } from '../schema/job-executions.js';
|
|
10
|
+
import { jobs } from '../schema/jobs.js';
|
|
11
|
+
import { steps } from '../schema/steps.js';
|
|
12
|
+
import { workflowRunAttempts } from '../schema/workflow-run-attempts.js';
|
|
13
|
+
import { toWorkflowRun, workflowRuns } from '../schema/workflow-runs.js';
|
|
14
|
+
import { updateJobStatusAtVersion } from './jobs.js';
|
|
15
|
+
import { lockWorkflowRun, TERMINAL_EXECUTION_STATUSES, TERMINAL_WORKFLOW_RUN_STATUSES } from './shared.js';
|
|
16
|
+
import { bulkUpdateStepStatuses } from './steps.js';
|
|
17
|
+
/**
|
|
18
|
+
* Shared terminal transition for a run attempt. The caller locks the run and the
|
|
19
|
+
* attempt (and decides how an already-terminal run is handled: timeout returns
|
|
20
|
+
* idempotently, cancellation rejects), then this drives every non-terminal job,
|
|
21
|
+
* execution, and step to `spec.terminalStatus`, resolves still-listening jobs,
|
|
22
|
+
* flips the attempt and run, and writes the outbox. Callers record metrics after
|
|
23
|
+
* the transaction commits.
|
|
24
|
+
*/ async function terminateRunAttempt(tx, params) {
|
|
25
|
+
const { lockedRun, lockedAttempt, spec } = params;
|
|
26
|
+
const runJobExecutionIds = tx.select({
|
|
27
|
+
id: jobExecutions.id
|
|
28
|
+
}).from(jobExecutions).innerJoin(jobs, eq(jobExecutions.jobId, jobs.id)).where(eq(jobs.workflowRunAttemptId, lockedAttempt.id));
|
|
29
|
+
await tx.select({
|
|
30
|
+
id: steps.id
|
|
31
|
+
}).from(steps).where(inArray(steps.jobExecutionId, runJobExecutionIds)).orderBy(asc(steps.jobExecutionId), asc(steps.position)).for('update');
|
|
32
|
+
const jobRows = await tx.select().from(jobs).where(eq(jobs.workflowRunAttemptId, lockedAttempt.id)).orderBy(asc(jobs.position), asc(jobs.id)).for('update');
|
|
33
|
+
const changedJobs = [];
|
|
34
|
+
for (const jobRow of jobRows){
|
|
35
|
+
if (isJobTerminal(jobRow.status)) continue;
|
|
36
|
+
const updated = await updateJobStatusAtVersion(tx, {
|
|
37
|
+
jobId: jobRow.id,
|
|
38
|
+
status: spec.terminalStatus,
|
|
39
|
+
expectedVersion: jobRow.version,
|
|
40
|
+
statusReason: spec.statusReason
|
|
41
|
+
});
|
|
42
|
+
if (updated?.changed) changedJobs.push(updated.job);
|
|
43
|
+
if (jobRow.mode === 'listening') {
|
|
44
|
+
await tx.update(jobs).set({
|
|
45
|
+
listenerStatus: 'resolved',
|
|
46
|
+
resolutionReason: 'cancelled',
|
|
47
|
+
updatedAt: new Date()
|
|
48
|
+
}).where(eq(jobs.id, jobRow.id));
|
|
49
|
+
}
|
|
50
|
+
const terminatedExecutions = await tx.update(jobExecutions).set({
|
|
51
|
+
status: spec.terminalStatus,
|
|
52
|
+
statusReason: spec.statusReason,
|
|
53
|
+
version: sql`${jobExecutions.version} + 1`,
|
|
54
|
+
updatedAt: new Date(),
|
|
55
|
+
finishedAt: sql`now()`,
|
|
56
|
+
...spec.markExecutionTimedOut ? {
|
|
57
|
+
timedOutAt: sql`now()`
|
|
58
|
+
} : {}
|
|
59
|
+
}).where(and(eq(jobExecutions.jobId, jobRow.id), notInArray(jobExecutions.status, TERMINAL_EXECUTION_STATUSES))).returning({
|
|
60
|
+
id: jobExecutions.id
|
|
61
|
+
});
|
|
62
|
+
for (const jobExecution of terminatedExecutions){
|
|
63
|
+
await bulkUpdateStepStatuses({
|
|
64
|
+
jobExecutionId: jobExecution.id,
|
|
65
|
+
status: spec.terminalStatus
|
|
66
|
+
}, tx);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
await tx.update(workflowRunAttempts).set({
|
|
70
|
+
status: spec.terminalStatus,
|
|
71
|
+
version: sql`${workflowRunAttempts.version} + 1`,
|
|
72
|
+
updatedAt: new Date(),
|
|
73
|
+
finishedAt: sql`now()`
|
|
74
|
+
}).where(and(eq(workflowRunAttempts.id, lockedAttempt.id), notInArray(workflowRunAttempts.status, TERMINAL_WORKFLOW_RUN_STATUSES)));
|
|
75
|
+
const [terminatedRunRow] = await tx.update(workflowRuns).set({
|
|
76
|
+
status: spec.terminalStatus,
|
|
77
|
+
version: sql`${workflowRuns.version} + 1`,
|
|
78
|
+
updatedAt: new Date(),
|
|
79
|
+
finishedAt: sql`now()`
|
|
80
|
+
}).where(and(eq(workflowRuns.id, lockedRun.id), notInArray(workflowRuns.status, TERMINAL_WORKFLOW_RUN_STATUSES))).returning();
|
|
81
|
+
const run = toWorkflowRun(terminatedRunRow ?? lockedRun);
|
|
82
|
+
await writeWorkflowsOutboxEvent(tx, {
|
|
83
|
+
type: WORKFLOWS_WORKFLOW_RUN_TERMINATED,
|
|
84
|
+
payload: {
|
|
85
|
+
workflowRunId: run.id,
|
|
86
|
+
workflowRunAttemptId: lockedAttempt.id,
|
|
87
|
+
projectId: run.projectId,
|
|
88
|
+
status: spec.terminalStatus
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (spec.emitCancelledEvent) {
|
|
92
|
+
await writeWorkflowsOutboxEvent(tx, {
|
|
93
|
+
type: WORKFLOWS_WORKFLOW_RUN_CANCELLED,
|
|
94
|
+
payload: {
|
|
95
|
+
workflowRunId: run.id,
|
|
96
|
+
workflowRunAttemptId: lockedAttempt.id,
|
|
97
|
+
projectId: run.projectId
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
run,
|
|
103
|
+
changedJobs
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export async function failWorkflowRunAsTimedOut(params) {
|
|
107
|
+
const result = await db().transaction(async (tx)=>{
|
|
108
|
+
const [lockedAttempt] = await tx.select().from(workflowRunAttempts).where(eq(workflowRunAttempts.id, params.runAttemptId)).limit(1).for('update');
|
|
109
|
+
if (!lockedAttempt) throw new WorkflowRunNotFoundError(params.runAttemptId);
|
|
110
|
+
const lockedRun = await lockWorkflowRun(lockedAttempt.workflowRunId, tx);
|
|
111
|
+
if (!lockedRun) throw new WorkflowRunNotFoundError(lockedAttempt.workflowRunId);
|
|
112
|
+
if (isWorkflowRunTerminal(lockedRun.status)) {
|
|
113
|
+
return {
|
|
114
|
+
run: toWorkflowRun(lockedRun),
|
|
115
|
+
changedJobs: [],
|
|
116
|
+
changed: false
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const result = await terminateRunAttempt(tx, {
|
|
120
|
+
lockedRun,
|
|
121
|
+
lockedAttempt,
|
|
122
|
+
spec: {
|
|
123
|
+
terminalStatus: 'failed',
|
|
124
|
+
statusReason: 'timed_out',
|
|
125
|
+
markExecutionTimedOut: true,
|
|
126
|
+
emitCancelledEvent: false
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
...result,
|
|
131
|
+
changed: true
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
if (result.changed) recordWorkflowRunStatusChanged(result.run.status);
|
|
135
|
+
for (const job of result.changedJobs)recordWorkflowJobStatusChanged(job.status);
|
|
136
|
+
return result.run;
|
|
137
|
+
}
|
|
138
|
+
export async function cancelWorkflowRun(params) {
|
|
139
|
+
const result = await db().transaction(async (tx)=>{
|
|
140
|
+
const lockedRun = await lockWorkflowRun(params.workflowRunId, tx);
|
|
141
|
+
if (!lockedRun) {
|
|
142
|
+
throw new WorkflowRunNotFoundError(params.workflowRunId);
|
|
143
|
+
}
|
|
144
|
+
if (isWorkflowRunTerminal(lockedRun.status)) {
|
|
145
|
+
throw new WorkflowRunNotCancellableError(lockedRun.id, lockedRun.status);
|
|
146
|
+
}
|
|
147
|
+
const [lockedAttempt] = await tx.select().from(workflowRunAttempts).where(and(eq(workflowRunAttempts.workflowRunId, lockedRun.id), eq(workflowRunAttempts.attempt, lockedRun.currentAttempt))).limit(1).for('update');
|
|
148
|
+
if (!lockedAttempt) {
|
|
149
|
+
throw new Error(`Current attempt ${lockedRun.currentAttempt} missing for run ${lockedRun.id}`);
|
|
150
|
+
}
|
|
151
|
+
return terminateRunAttempt(tx, {
|
|
152
|
+
lockedRun,
|
|
153
|
+
lockedAttempt,
|
|
154
|
+
spec: {
|
|
155
|
+
terminalStatus: 'cancelled',
|
|
156
|
+
statusReason: 'run_cancelled',
|
|
157
|
+
markExecutionTimedOut: false,
|
|
158
|
+
emitCancelledEvent: true
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
recordWorkflowRunStatusChanged(result.run.status);
|
|
163
|
+
for (const job of result.changedJobs)recordWorkflowJobStatusChanged(job.status);
|
|
164
|
+
return result.run;
|
|
165
|
+
}
|
|
166
|
+
export async function updateWorkflowRunStatus(params) {
|
|
167
|
+
const result = await db().transaction(async (tx)=>{
|
|
168
|
+
const [attemptRef] = params.workflowRunAttemptId ? await tx.select({
|
|
169
|
+
id: workflowRunAttempts.id,
|
|
170
|
+
workflowRunId: workflowRunAttempts.workflowRunId
|
|
171
|
+
}).from(workflowRunAttempts).where(eq(workflowRunAttempts.id, params.workflowRunAttemptId)).limit(1) : [];
|
|
172
|
+
const workflowRunId = attemptRef?.workflowRunId ?? params.workflowRunId ?? '';
|
|
173
|
+
const lockedRun = await lockWorkflowRun(workflowRunId, tx);
|
|
174
|
+
if (!lockedRun) {
|
|
175
|
+
throw new WorkflowRunNotFoundError(params.workflowRunId ?? params.workflowRunAttemptId ?? '');
|
|
176
|
+
}
|
|
177
|
+
const [lockedAttempt] = await tx.select().from(workflowRunAttempts).where(params.workflowRunAttemptId ? eq(workflowRunAttempts.id, params.workflowRunAttemptId) : and(eq(workflowRunAttempts.workflowRunId, lockedRun.id), eq(workflowRunAttempts.attempt, lockedRun.currentAttempt))).limit(1).for('update');
|
|
178
|
+
if (!lockedAttempt) {
|
|
179
|
+
throw new WorkflowRunNotFoundError(params.workflowRunId ?? params.workflowRunAttemptId ?? '');
|
|
180
|
+
}
|
|
181
|
+
const target = {
|
|
182
|
+
run: lockedRun,
|
|
183
|
+
attempt: lockedAttempt
|
|
184
|
+
};
|
|
185
|
+
const rows = await tx.update(workflowRunAttempts).set({
|
|
186
|
+
status: params.status,
|
|
187
|
+
version: sql`${workflowRunAttempts.version} + 1`,
|
|
188
|
+
updatedAt: new Date(),
|
|
189
|
+
...params.status === 'running' ? {
|
|
190
|
+
startedAt: sql`coalesce(${workflowRunAttempts.startedAt}, now())`
|
|
191
|
+
} : {},
|
|
192
|
+
...isWorkflowRunTerminal(params.status) ? {
|
|
193
|
+
finishedAt: sql`now()`
|
|
194
|
+
} : {}
|
|
195
|
+
}).where(and(eq(workflowRunAttempts.id, target.attempt.id), eq(workflowRunAttempts.version, params.expectedVersion), notInArray(workflowRunAttempts.status, TERMINAL_WORKFLOW_RUN_STATUSES))).returning();
|
|
196
|
+
const attemptRow = rows[0];
|
|
197
|
+
if (!attemptRow) {
|
|
198
|
+
const existing = await tx.select().from(workflowRunAttempts).where(eq(workflowRunAttempts.id, target.attempt.id)).limit(1);
|
|
199
|
+
const existingRow = existing[0];
|
|
200
|
+
if (existingRow && (existingRow.status === params.status || isWorkflowRunTerminal(existingRow.status))) {
|
|
201
|
+
return {
|
|
202
|
+
run: {
|
|
203
|
+
...toWorkflowRun(target.run),
|
|
204
|
+
version: existingRow.version
|
|
205
|
+
},
|
|
206
|
+
changed: false
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
throw new Error(`Optimistic lock failure: run attempt ${target.attempt.id} version ${params.expectedVersion}`);
|
|
210
|
+
}
|
|
211
|
+
const shouldMirror = target.run.currentAttempt === attemptRow.attempt;
|
|
212
|
+
const [runRow] = shouldMirror ? await tx.update(workflowRuns).set({
|
|
213
|
+
status: params.status,
|
|
214
|
+
version: sql`${workflowRuns.version} + 1`,
|
|
215
|
+
updatedAt: new Date(),
|
|
216
|
+
...params.status === 'running' ? {
|
|
217
|
+
startedAt: sql`coalesce(${workflowRuns.startedAt}, now())`
|
|
218
|
+
} : {},
|
|
219
|
+
...isWorkflowRunTerminal(params.status) ? {
|
|
220
|
+
finishedAt: sql`now()`
|
|
221
|
+
} : {}
|
|
222
|
+
}).where(eq(workflowRuns.id, target.run.id)).returning() : [
|
|
223
|
+
target.run
|
|
224
|
+
];
|
|
225
|
+
const run = {
|
|
226
|
+
...toWorkflowRun(runRow ?? target.run),
|
|
227
|
+
version: attemptRow.version
|
|
228
|
+
};
|
|
229
|
+
if (shouldMirror && isWorkflowRunTerminal(run.status)) {
|
|
230
|
+
await writeWorkflowsOutboxEvent(tx, {
|
|
231
|
+
type: WORKFLOWS_WORKFLOW_RUN_TERMINATED,
|
|
232
|
+
payload: {
|
|
233
|
+
workflowRunId: run.id,
|
|
234
|
+
workflowRunAttemptId: attemptRow.id,
|
|
235
|
+
projectId: run.projectId,
|
|
236
|
+
status: run.status
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
run,
|
|
242
|
+
changed: true
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
if (result.changed) recordWorkflowRunStatusChanged(result.run.status);
|
|
246
|
+
return result.run;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
//# sourceMappingURL=run-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/db/workflow-runs/run-status.ts"],"sourcesContent":["import {\n WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n WORKFLOWS_WORKFLOW_RUN_TERMINATED,\n} from '@shipfox/api-workflows-dto';\nimport {and, asc, eq, inArray, notInArray, sql} from 'drizzle-orm';\nimport {isJobTerminal, type Job, type JobStatusReason} from '#core/entities/job.js';\nimport {\n isWorkflowRunTerminal,\n type WorkflowRun,\n type WorkflowRunStatus,\n} from '#core/entities/workflow-run.js';\nimport {WorkflowRunNotCancellableError, WorkflowRunNotFoundError} from '#core/errors.js';\nimport {recordWorkflowJobStatusChanged, recordWorkflowRunStatusChanged} from '#metrics/instance.js';\nimport {db, type Tx} from '../db.js';\nimport {writeWorkflowsOutboxEvent} from '../outbox-writes.js';\nimport {jobExecutions} from '../schema/job-executions.js';\nimport {jobs} from '../schema/jobs.js';\nimport {steps} from '../schema/steps.js';\nimport {workflowRunAttempts} from '../schema/workflow-run-attempts.js';\nimport {toWorkflowRun, workflowRuns} from '../schema/workflow-runs.js';\nimport {updateJobStatusAtVersion} from './jobs.js';\nimport {\n lockWorkflowRun,\n TERMINAL_EXECUTION_STATUSES,\n TERMINAL_WORKFLOW_RUN_STATUSES,\n} from './shared.js';\nimport {bulkUpdateStepStatuses} from './steps.js';\n\nexport interface CancelWorkflowRunParams {\n workflowRunId: string;\n}\n\nexport interface FailWorkflowRunAsTimedOutParams {\n runAttemptId: string;\n}\n\nexport interface RunTerminationSpec {\n terminalStatus: Extract<WorkflowRunStatus, 'failed' | 'cancelled'>;\n statusReason: Extract<JobStatusReason, 'timed_out' | 'run_cancelled'>;\n markExecutionTimedOut: boolean;\n emitCancelledEvent: boolean;\n}\n\n/**\n * Shared terminal transition for a run attempt. The caller locks the run and the\n * attempt (and decides how an already-terminal run is handled: timeout returns\n * idempotently, cancellation rejects), then this drives every non-terminal job,\n * execution, and step to `spec.terminalStatus`, resolves still-listening jobs,\n * flips the attempt and run, and writes the outbox. Callers record metrics after\n * the transaction commits.\n */\nasync function terminateRunAttempt(\n tx: Tx,\n params: {\n lockedRun: typeof workflowRuns.$inferSelect;\n lockedAttempt: typeof workflowRunAttempts.$inferSelect;\n spec: RunTerminationSpec;\n },\n): Promise<{run: WorkflowRun; changedJobs: Job[]}> {\n const {lockedRun, lockedAttempt, spec} = params;\n\n const runJobExecutionIds = tx\n .select({id: jobExecutions.id})\n .from(jobExecutions)\n .innerJoin(jobs, eq(jobExecutions.jobId, jobs.id))\n .where(eq(jobs.workflowRunAttemptId, lockedAttempt.id));\n\n await tx\n .select({id: steps.id})\n .from(steps)\n .where(inArray(steps.jobExecutionId, runJobExecutionIds))\n .orderBy(asc(steps.jobExecutionId), asc(steps.position))\n .for('update');\n\n const jobRows = await tx\n .select()\n .from(jobs)\n .where(eq(jobs.workflowRunAttemptId, lockedAttempt.id))\n .orderBy(asc(jobs.position), asc(jobs.id))\n .for('update');\n\n const changedJobs: Job[] = [];\n for (const jobRow of jobRows) {\n if (isJobTerminal(jobRow.status)) continue;\n\n const updated = await updateJobStatusAtVersion(tx, {\n jobId: jobRow.id,\n status: spec.terminalStatus,\n expectedVersion: jobRow.version,\n statusReason: spec.statusReason,\n });\n if (updated?.changed) changedJobs.push(updated.job);\n\n if (jobRow.mode === 'listening') {\n await tx\n .update(jobs)\n .set({listenerStatus: 'resolved', resolutionReason: 'cancelled', updatedAt: new Date()})\n .where(eq(jobs.id, jobRow.id));\n }\n\n const terminatedExecutions = await tx\n .update(jobExecutions)\n .set({\n status: spec.terminalStatus,\n statusReason: spec.statusReason,\n version: sql`${jobExecutions.version} + 1`,\n updatedAt: new Date(),\n finishedAt: sql`now()`,\n ...(spec.markExecutionTimedOut ? {timedOutAt: sql`now()`} : {}),\n })\n .where(\n and(\n eq(jobExecutions.jobId, jobRow.id),\n notInArray(jobExecutions.status, TERMINAL_EXECUTION_STATUSES),\n ),\n )\n .returning({id: jobExecutions.id});\n for (const jobExecution of terminatedExecutions) {\n await bulkUpdateStepStatuses(\n {jobExecutionId: jobExecution.id, status: spec.terminalStatus},\n tx,\n );\n }\n }\n\n await tx\n .update(workflowRunAttempts)\n .set({\n status: spec.terminalStatus,\n version: sql`${workflowRunAttempts.version} + 1`,\n updatedAt: new Date(),\n finishedAt: sql`now()`,\n })\n .where(\n and(\n eq(workflowRunAttempts.id, lockedAttempt.id),\n notInArray(workflowRunAttempts.status, TERMINAL_WORKFLOW_RUN_STATUSES),\n ),\n );\n\n const [terminatedRunRow] = await tx\n .update(workflowRuns)\n .set({\n status: spec.terminalStatus,\n version: sql`${workflowRuns.version} + 1`,\n updatedAt: new Date(),\n finishedAt: sql`now()`,\n })\n .where(\n and(\n eq(workflowRuns.id, lockedRun.id),\n notInArray(workflowRuns.status, TERMINAL_WORKFLOW_RUN_STATUSES),\n ),\n )\n .returning();\n\n const run = toWorkflowRun(terminatedRunRow ?? lockedRun);\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_WORKFLOW_RUN_TERMINATED,\n payload: {\n workflowRunId: run.id,\n workflowRunAttemptId: lockedAttempt.id,\n projectId: run.projectId,\n status: spec.terminalStatus,\n },\n });\n if (spec.emitCancelledEvent) {\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n payload: {\n workflowRunId: run.id,\n workflowRunAttemptId: lockedAttempt.id,\n projectId: run.projectId,\n },\n });\n }\n\n return {run, changedJobs};\n}\n\nexport async function failWorkflowRunAsTimedOut(\n params: FailWorkflowRunAsTimedOutParams,\n): Promise<WorkflowRun> {\n const result = await db().transaction(async (tx) => {\n const [lockedAttempt] = await tx\n .select()\n .from(workflowRunAttempts)\n .where(eq(workflowRunAttempts.id, params.runAttemptId))\n .limit(1)\n .for('update');\n if (!lockedAttempt) throw new WorkflowRunNotFoundError(params.runAttemptId);\n\n const lockedRun = await lockWorkflowRun(lockedAttempt.workflowRunId, tx);\n if (!lockedRun) throw new WorkflowRunNotFoundError(lockedAttempt.workflowRunId);\n if (isWorkflowRunTerminal(lockedRun.status)) {\n return {run: toWorkflowRun(lockedRun), changedJobs: [], changed: false};\n }\n\n const result = await terminateRunAttempt(tx, {\n lockedRun,\n lockedAttempt,\n spec: {\n terminalStatus: 'failed',\n statusReason: 'timed_out',\n markExecutionTimedOut: true,\n emitCancelledEvent: false,\n },\n });\n return {...result, changed: true};\n });\n\n if (result.changed) recordWorkflowRunStatusChanged(result.run.status);\n for (const job of result.changedJobs) recordWorkflowJobStatusChanged(job.status);\n return result.run;\n}\n\nexport async function cancelWorkflowRun(params: CancelWorkflowRunParams): Promise<WorkflowRun> {\n const result = await db().transaction(async (tx) => {\n const lockedRun = await lockWorkflowRun(params.workflowRunId, tx);\n\n if (!lockedRun) {\n throw new WorkflowRunNotFoundError(params.workflowRunId);\n }\n if (isWorkflowRunTerminal(lockedRun.status)) {\n throw new WorkflowRunNotCancellableError(lockedRun.id, lockedRun.status);\n }\n\n const [lockedAttempt] = await tx\n .select()\n .from(workflowRunAttempts)\n .where(\n and(\n eq(workflowRunAttempts.workflowRunId, lockedRun.id),\n eq(workflowRunAttempts.attempt, lockedRun.currentAttempt),\n ),\n )\n .limit(1)\n .for('update');\n if (!lockedAttempt) {\n throw new Error(\n `Current attempt ${lockedRun.currentAttempt} missing for run ${lockedRun.id}`,\n );\n }\n\n return terminateRunAttempt(tx, {\n lockedRun,\n lockedAttempt,\n spec: {\n terminalStatus: 'cancelled',\n statusReason: 'run_cancelled',\n markExecutionTimedOut: false,\n emitCancelledEvent: true,\n },\n });\n });\n\n recordWorkflowRunStatusChanged(result.run.status);\n for (const job of result.changedJobs) recordWorkflowJobStatusChanged(job.status);\n\n return result.run;\n}\n\nexport interface UpdateWorkflowRunStatusParams {\n workflowRunId?: string;\n workflowRunAttemptId?: string;\n status: WorkflowRunStatus;\n expectedVersion: number;\n}\n\nexport async function updateWorkflowRunStatus(\n params: UpdateWorkflowRunStatusParams,\n): Promise<WorkflowRun> {\n const result = await db().transaction(async (tx) => {\n const [attemptRef] = params.workflowRunAttemptId\n ? await tx\n .select({\n id: workflowRunAttempts.id,\n workflowRunId: workflowRunAttempts.workflowRunId,\n })\n .from(workflowRunAttempts)\n .where(eq(workflowRunAttempts.id, params.workflowRunAttemptId))\n .limit(1)\n : [];\n\n const workflowRunId = attemptRef?.workflowRunId ?? params.workflowRunId ?? '';\n const lockedRun = await lockWorkflowRun(workflowRunId, tx);\n\n if (!lockedRun) {\n throw new WorkflowRunNotFoundError(params.workflowRunId ?? params.workflowRunAttemptId ?? '');\n }\n\n const [lockedAttempt] = await tx\n .select()\n .from(workflowRunAttempts)\n .where(\n params.workflowRunAttemptId\n ? eq(workflowRunAttempts.id, params.workflowRunAttemptId)\n : and(\n eq(workflowRunAttempts.workflowRunId, lockedRun.id),\n eq(workflowRunAttempts.attempt, lockedRun.currentAttempt),\n ),\n )\n .limit(1)\n .for('update');\n\n if (!lockedAttempt) {\n throw new WorkflowRunNotFoundError(params.workflowRunId ?? params.workflowRunAttemptId ?? '');\n }\n\n const target = {run: lockedRun, attempt: lockedAttempt};\n\n const rows = await tx\n .update(workflowRunAttempts)\n .set({\n status: params.status,\n version: sql`${workflowRunAttempts.version} + 1`,\n updatedAt: new Date(),\n ...(params.status === 'running'\n ? {startedAt: sql`coalesce(${workflowRunAttempts.startedAt}, now())`}\n : {}),\n ...(isWorkflowRunTerminal(params.status) ? {finishedAt: sql`now()`} : {}),\n })\n .where(\n and(\n eq(workflowRunAttempts.id, target.attempt.id),\n eq(workflowRunAttempts.version, params.expectedVersion),\n notInArray(workflowRunAttempts.status, TERMINAL_WORKFLOW_RUN_STATUSES),\n ),\n )\n .returning();\n\n const attemptRow = rows[0];\n if (!attemptRow) {\n const existing = await tx\n .select()\n .from(workflowRunAttempts)\n .where(eq(workflowRunAttempts.id, target.attempt.id))\n .limit(1);\n const existingRow = existing[0];\n if (\n existingRow &&\n (existingRow.status === params.status || isWorkflowRunTerminal(existingRow.status))\n ) {\n return {\n run: {...toWorkflowRun(target.run), version: existingRow.version},\n changed: false,\n };\n }\n throw new Error(\n `Optimistic lock failure: run attempt ${target.attempt.id} version ${params.expectedVersion}`,\n );\n }\n\n const shouldMirror = target.run.currentAttempt === attemptRow.attempt;\n const [runRow] = shouldMirror\n ? await tx\n .update(workflowRuns)\n .set({\n status: params.status,\n version: sql`${workflowRuns.version} + 1`,\n updatedAt: new Date(),\n ...(params.status === 'running'\n ? {startedAt: sql`coalesce(${workflowRuns.startedAt}, now())`}\n : {}),\n ...(isWorkflowRunTerminal(params.status) ? {finishedAt: sql`now()`} : {}),\n })\n .where(eq(workflowRuns.id, target.run.id))\n .returning()\n : [target.run];\n\n const run = {...toWorkflowRun(runRow ?? target.run), version: attemptRow.version};\n\n if (shouldMirror && isWorkflowRunTerminal(run.status)) {\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_WORKFLOW_RUN_TERMINATED,\n payload: {\n workflowRunId: run.id,\n workflowRunAttemptId: attemptRow.id,\n projectId: run.projectId,\n status: run.status,\n },\n });\n }\n\n return {run, changed: true};\n });\n\n if (result.changed) recordWorkflowRunStatusChanged(result.run.status);\n\n return result.run;\n}\n"],"names":["WORKFLOWS_WORKFLOW_RUN_CANCELLED","WORKFLOWS_WORKFLOW_RUN_TERMINATED","and","asc","eq","inArray","notInArray","sql","isJobTerminal","isWorkflowRunTerminal","WorkflowRunNotCancellableError","WorkflowRunNotFoundError","recordWorkflowJobStatusChanged","recordWorkflowRunStatusChanged","db","writeWorkflowsOutboxEvent","jobExecutions","jobs","steps","workflowRunAttempts","toWorkflowRun","workflowRuns","updateJobStatusAtVersion","lockWorkflowRun","TERMINAL_EXECUTION_STATUSES","TERMINAL_WORKFLOW_RUN_STATUSES","bulkUpdateStepStatuses","terminateRunAttempt","tx","params","lockedRun","lockedAttempt","spec","runJobExecutionIds","select","id","from","innerJoin","jobId","where","workflowRunAttemptId","jobExecutionId","orderBy","position","for","jobRows","changedJobs","jobRow","status","updated","terminalStatus","expectedVersion","version","statusReason","changed","push","job","mode","update","set","listenerStatus","resolutionReason","updatedAt","Date","terminatedExecutions","finishedAt","markExecutionTimedOut","timedOutAt","returning","jobExecution","terminatedRunRow","run","type","payload","workflowRunId","projectId","emitCancelledEvent","failWorkflowRunAsTimedOut","result","transaction","runAttemptId","limit","cancelWorkflowRun","attempt","currentAttempt","Error","updateWorkflowRunStatus","attemptRef","target","rows","startedAt","attemptRow","existing","existingRow","shouldMirror","runRow"],"mappings":"AAAA,SACEA,gCAAgC,EAChCC,iCAAiC,QAC5B,6BAA6B;AACpC,SAAQC,GAAG,EAAEC,GAAG,EAAEC,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAEC,GAAG,QAAO,cAAc;AACnE,SAAQC,aAAa,QAAuC,wBAAwB;AACpF,SACEC,qBAAqB,QAGhB,iCAAiC;AACxC,SAAQC,8BAA8B,EAAEC,wBAAwB,QAAO,kBAAkB;AACzF,SAAQC,8BAA8B,EAAEC,8BAA8B,QAAO,uBAAuB;AACpG,SAAQC,EAAE,QAAgB,WAAW;AACrC,SAAQC,yBAAyB,QAAO,sBAAsB;AAC9D,S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A;QAEhF,IAAI0C,gBAAgBrF,sBAAsB8D,IAAIvB,MAAM,GAAG;YACrD,MAAMjC,0BAA0Ba,IAAI;gBAClC4C,MAAMvE;gBACNwE,SAAS;oBACPC,eAAeH,IAAIpC,EAAE;oBACrBK,sBAAsBmD,WAAWxD,EAAE;oBACnCwC,WAAWJ,IAAII,SAAS;oBACxB3B,QAAQuB,IAAIvB,MAAM;gBACpB;YACF;QACF;QAEA,OAAO;YAACuB;YAAKjB,SAAS;QAAI;IAC5B;IAEA,IAAIwB,OAAOxB,OAAO,EAAEzC,+BAA+BiE,OAAOP,GAAG,CAACvB,MAAM;IAEpE,OAAO8B,OAAOP,GAAG;AACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { CreateWorkflowRunParams } from './run-create.js';
|
|
2
|
+
export { createWorkflowRun, loadReferencedVariables, } from './run-create.js';
|
|
3
|
+
export type { CreateRerunWorkflowRunParams } from './run-rerun.js';
|
|
4
|
+
export { createRerunWorkflowRun } from './run-rerun.js';
|
|
5
|
+
export type { CancelWorkflowRunParams, FailWorkflowRunAsTimedOutParams, UpdateWorkflowRunStatusParams, } from './run-status.js';
|
|
6
|
+
export { cancelWorkflowRun, failWorkflowRunAsTimedOut, updateWorkflowRunStatus, } from './run-status.js';
|
|
7
|
+
//# sourceMappingURL=runs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/runs.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAC,4BAA4B,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,YAAY,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createWorkflowRun, loadReferencedVariables } from './run-create.js';
|
|
2
|
+
export { createRerunWorkflowRun } from './run-rerun.js';
|
|
3
|
+
export { cancelWorkflowRun, failWorkflowRunAsTimedOut, updateWorkflowRunStatus } from './run-status.js';
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=runs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/db/workflow-runs/runs.ts"],"sourcesContent":["export type {CreateWorkflowRunParams} from './run-create.js';\nexport {\n createWorkflowRun,\n loadReferencedVariables,\n} from './run-create.js';\nexport type {CreateRerunWorkflowRunParams} from './run-rerun.js';\nexport {createRerunWorkflowRun} from './run-rerun.js';\nexport type {\n CancelWorkflowRunParams,\n FailWorkflowRunAsTimedOutParams,\n UpdateWorkflowRunStatusParams,\n} from './run-status.js';\nexport {\n cancelWorkflowRun,\n failWorkflowRunAsTimedOut,\n updateWorkflowRunStatus,\n} from './run-status.js';\n"],"names":["createWorkflowRun","loadReferencedVariables","createRerunWorkflowRun","cancelWorkflowRun","failWorkflowRunAsTimedOut","updateWorkflowRunStatus"],"mappings":"AACA,SACEA,iBAAiB,EACjBC,uBAAuB,QAClB,kBAAkB;AAEzB,SAAQC,sBAAsB,QAAO,iBAAiB;AAMtD,SACEC,iBAAiB,EACjBC,yBAAyB,EACzBC,uBAAuB,QAClB,kBAAkB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JobStatus } from '#core/entities/job.js';
|
|
2
|
+
import type { JobExecutionStatus } from '#core/entities/job-execution.js';
|
|
3
|
+
import type { WorkflowRunStatus } from '#core/entities/workflow-run.js';
|
|
4
|
+
import type { Tx } from '../db.js';
|
|
5
|
+
import { workflowRuns } from '../schema/workflow-runs.js';
|
|
6
|
+
export declare const TERMINAL_WORKFLOW_RUN_STATUSES: WorkflowRunStatus[];
|
|
7
|
+
export declare const TERMINAL_JOB_STATUSES: JobStatus[];
|
|
8
|
+
export declare const TERMINAL_EXECUTION_STATUSES: JobExecutionStatus[];
|
|
9
|
+
export declare const NON_TERMINAL_STEP_STATUS_FILTER: import("drizzle-orm").SQL<unknown>;
|
|
10
|
+
export declare function lockWorkflowRun(id: string, tx: Tx): Promise<typeof workflowRuns.$inferSelect | undefined>;
|
|
11
|
+
export declare function optimisticLockRetry<TResult, TFetched>(params: {
|
|
12
|
+
updateFn: () => Promise<TResult | null>;
|
|
13
|
+
fetchFn: () => Promise<TFetched | undefined>;
|
|
14
|
+
matchFn: (value: TFetched) => TResult | null;
|
|
15
|
+
failureMessage: string;
|
|
16
|
+
}): Promise<TResult>;
|
|
17
|
+
export declare function getWorkflowContextForJob(jobId: string, tx: Tx): Promise<{
|
|
18
|
+
jobId: string;
|
|
19
|
+
workflowRunId: string;
|
|
20
|
+
workflowRunAttemptId: string;
|
|
21
|
+
workspaceId: string;
|
|
22
|
+
projectId: string;
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAExD,eAAO,MAAM,8BAA8B,EAAE,iBAAiB,EAI7D,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,SAAS,EAAoD,CAAC;AAElG,eAAO,MAAM,2BAA2B,EAAE,kBAAkB,EAI3D,CAAC;AAEF,eAAO,MAAM,+BAA+B,oCAA2E,CAAC;AAExH,wBAAsB,eAAe,CACnC,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,EAAE,GACL,OAAO,CAAC,OAAO,YAAY,CAAC,YAAY,GAAG,SAAS,CAAC,CAQvD;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;IACnE,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;IAC7C,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG,IAAI,CAAC;IAC7C,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAWnB;AAED,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,EAAE,GACL,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAiBD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { eq, sql } from 'drizzle-orm';
|
|
2
|
+
import { jobs } from '../schema/jobs.js';
|
|
3
|
+
import { steps } from '../schema/steps.js';
|
|
4
|
+
import { workflowRunAttempts } from '../schema/workflow-run-attempts.js';
|
|
5
|
+
import { workflowRuns } from '../schema/workflow-runs.js';
|
|
6
|
+
export const TERMINAL_WORKFLOW_RUN_STATUSES = [
|
|
7
|
+
'succeeded',
|
|
8
|
+
'failed',
|
|
9
|
+
'cancelled'
|
|
10
|
+
];
|
|
11
|
+
export const TERMINAL_JOB_STATUSES = [
|
|
12
|
+
'succeeded',
|
|
13
|
+
'failed',
|
|
14
|
+
'cancelled',
|
|
15
|
+
'skipped'
|
|
16
|
+
];
|
|
17
|
+
export const TERMINAL_EXECUTION_STATUSES = [
|
|
18
|
+
'succeeded',
|
|
19
|
+
'failed',
|
|
20
|
+
'cancelled'
|
|
21
|
+
];
|
|
22
|
+
export const NON_TERMINAL_STEP_STATUS_FILTER = sql`${steps.status} NOT IN ('succeeded','failed','cancelled','skipped')`;
|
|
23
|
+
export async function lockWorkflowRun(id, tx) {
|
|
24
|
+
const rows = await tx.select().from(workflowRuns).where(eq(workflowRuns.id, id)).limit(1).for('update');
|
|
25
|
+
return rows[0];
|
|
26
|
+
}
|
|
27
|
+
export async function optimisticLockRetry(params) {
|
|
28
|
+
const updated = await params.updateFn();
|
|
29
|
+
if (updated) return updated;
|
|
30
|
+
const existing = await params.fetchFn();
|
|
31
|
+
if (existing) {
|
|
32
|
+
const matched = params.matchFn(existing);
|
|
33
|
+
if (matched) return matched;
|
|
34
|
+
}
|
|
35
|
+
throw new Error(params.failureMessage);
|
|
36
|
+
}
|
|
37
|
+
export async function getWorkflowContextForJob(jobId, tx) {
|
|
38
|
+
const rows = await tx.select({
|
|
39
|
+
jobId: jobs.id,
|
|
40
|
+
workflowRunId: workflowRuns.id,
|
|
41
|
+
workflowRunAttemptId: workflowRunAttempts.id,
|
|
42
|
+
workspaceId: workflowRuns.workspaceId,
|
|
43
|
+
projectId: workflowRuns.projectId
|
|
44
|
+
}).from(jobs).innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id)).innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id)).where(eq(jobs.id, jobId)).limit(1);
|
|
45
|
+
const context = rows[0];
|
|
46
|
+
if (!context) throw new Error(`Cannot load workflow context: job ${jobId} not found`);
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/db/workflow-runs/shared.ts"],"sourcesContent":["import {eq, sql} from 'drizzle-orm';\nimport type {JobStatus} from '#core/entities/job.js';\nimport type {JobExecutionStatus} from '#core/entities/job-execution.js';\nimport type {WorkflowRunStatus} from '#core/entities/workflow-run.js';\nimport type {Tx} from '../db.js';\nimport {jobs} from '../schema/jobs.js';\nimport {steps} from '../schema/steps.js';\nimport {workflowRunAttempts} from '../schema/workflow-run-attempts.js';\nimport {workflowRuns} from '../schema/workflow-runs.js';\n\nexport const TERMINAL_WORKFLOW_RUN_STATUSES: WorkflowRunStatus[] = [\n 'succeeded',\n 'failed',\n 'cancelled',\n];\n\nexport const TERMINAL_JOB_STATUSES: JobStatus[] = ['succeeded', 'failed', 'cancelled', 'skipped'];\n\nexport const TERMINAL_EXECUTION_STATUSES: JobExecutionStatus[] = [\n 'succeeded',\n 'failed',\n 'cancelled',\n];\n\nexport const NON_TERMINAL_STEP_STATUS_FILTER = sql`${steps.status} NOT IN ('succeeded','failed','cancelled','skipped')`;\n\nexport async function lockWorkflowRun(\n id: string,\n tx: Tx,\n): Promise<typeof workflowRuns.$inferSelect | undefined> {\n const rows = await tx\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.id, id))\n .limit(1)\n .for('update');\n return rows[0];\n}\n\nexport async function optimisticLockRetry<TResult, TFetched>(params: {\n updateFn: () => Promise<TResult | null>;\n fetchFn: () => Promise<TFetched | undefined>;\n matchFn: (value: TFetched) => TResult | null;\n failureMessage: string;\n}): Promise<TResult> {\n const updated = await params.updateFn();\n if (updated) return updated;\n\n const existing = await params.fetchFn();\n if (existing) {\n const matched = params.matchFn(existing);\n if (matched) return matched;\n }\n\n throw new Error(params.failureMessage);\n}\n\nexport async function getWorkflowContextForJob(\n jobId: string,\n tx: Tx,\n): Promise<{\n jobId: string;\n workflowRunId: string;\n workflowRunAttemptId: string;\n workspaceId: string;\n projectId: string;\n}> {\n const rows = await tx\n .select({\n jobId: jobs.id,\n workflowRunId: workflowRuns.id,\n workflowRunAttemptId: workflowRunAttempts.id,\n workspaceId: workflowRuns.workspaceId,\n projectId: workflowRuns.projectId,\n })\n .from(jobs)\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id))\n .where(eq(jobs.id, jobId))\n .limit(1);\n const context = rows[0];\n if (!context) throw new Error(`Cannot load workflow context: job ${jobId} not found`);\n return context;\n}\n"],"names":["eq","sql","jobs","steps","workflowRunAttempts","workflowRuns","TERMINAL_WORKFLOW_RUN_STATUSES","TERMINAL_JOB_STATUSES","TERMINAL_EXECUTION_STATUSES","NON_TERMINAL_STEP_STATUS_FILTER","status","lockWorkflowRun","id","tx","rows","select","from","where","limit","for","optimisticLockRetry","params","updated","updateFn","existing","fetchFn","matched","matchFn","Error","failureMessage","getWorkflowContextForJob","jobId","workflowRunId","workflowRunAttemptId","workspaceId","projectId","innerJoin","context"],"mappings":"AAAA,SAAQA,EAAE,EAAEC,GAAG,QAAO,cAAc;AAKpC,SAAQC,IAAI,QAAO,oBAAoB;AACvC,SAAQC,KAAK,QAAO,qBAAqB;AACzC,SAAQC,mBAAmB,QAAO,qCAAqC;AACvE,SAAQC,YAAY,QAAO,6BAA6B;AAExD,OAAO,MAAMC,iCAAsD;IACjE;IACA;IACA;CACD,CAAC;AAEF,OAAO,MAAMC,wBAAqC;IAAC;IAAa;IAAU;IAAa;CAAU,CAAC;AAElG,OAAO,MAAMC,8BAAoD;IAC/D;IACA;IACA;CACD,CAAC;AAEF,OAAO,MAAMC,kCAAkCR,GAAG,CAAC,EAAEE,MAAMO,MAAM,CAAC,oDAAoD,CAAC,CAAC;AAExH,OAAO,eAAeC,gBACpBC,EAAU,EACVC,EAAM;IAEN,MAAMC,OAAO,MAAMD,GAChBE,MAAM,GACNC,IAAI,CAACX,cACLY,KAAK,CAACjB,GAAGK,aAAaO,EAAE,EAAEA,KAC1BM,KAAK,CAAC,GACNC,GAAG,CAAC;IACP,OAAOL,IAAI,CAAC,EAAE;AAChB;AAEA,OAAO,eAAeM,oBAAuCC,MAK5D;IACC,MAAMC,UAAU,MAAMD,OAAOE,QAAQ;IACrC,IAAID,SAAS,OAAOA;IAEpB,MAAME,WAAW,MAAMH,OAAOI,OAAO;IACrC,IAAID,UAAU;QACZ,MAAME,UAAUL,OAAOM,OAAO,CAACH;QAC/B,IAAIE,SAAS,OAAOA;IACtB;IAEA,MAAM,IAAIE,MAAMP,OAAOQ,cAAc;AACvC;AAEA,OAAO,eAAeC,yBACpBC,KAAa,EACblB,EAAM;IAQN,MAAMC,OAAO,MAAMD,GAChBE,MAAM,CAAC;QACNgB,OAAO7B,KAAKU,EAAE;QACdoB,eAAe3B,aAAaO,EAAE;QAC9BqB,sBAAsB7B,oBAAoBQ,EAAE;QAC5CsB,aAAa7B,aAAa6B,WAAW;QACrCC,WAAW9B,aAAa8B,SAAS;IACnC,GACCnB,IAAI,CAACd,MACLkC,SAAS,CAAChC,qBAAqBJ,GAAGE,KAAK+B,oBAAoB,EAAE7B,oBAAoBQ,EAAE,GACnFwB,SAAS,CAAC/B,cAAcL,GAAGI,oBAAoB4B,aAAa,EAAE3B,aAAaO,EAAE,GAC7EK,KAAK,CAACjB,GAAGE,KAAKU,EAAE,EAAEmB,QAClBb,KAAK,CAAC;IACT,MAAMmB,UAAUvB,IAAI,CAAC,EAAE;IACvB,IAAI,CAACuB,SAAS,MAAM,IAAIT,MAAM,CAAC,kCAAkC,EAAEG,MAAM,UAAU,CAAC;IACpF,OAAOM;AACT"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { LogOutcomeDto } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import type { PersistedEvaluationTraceEntry, Step, StepAttempt, StepAttemptStatus, StepStatus, StepStatusReason } from '#core/entities/step.js';
|
|
3
|
+
import { type Tx } from '../db.js';
|
|
4
|
+
export declare function getStepByIdForJobExecution(params: {
|
|
5
|
+
stepId: string;
|
|
6
|
+
jobExecutionId: string;
|
|
7
|
+
}): Promise<Step | undefined>;
|
|
8
|
+
export declare function getStepById(stepId: string): Promise<Step | undefined>;
|
|
9
|
+
export declare function getStepsByJobId(jobId: string): Promise<Step[]>;
|
|
10
|
+
export declare function getStepsByJobExecutionId(jobExecutionId: string): Promise<Step[]>;
|
|
11
|
+
export interface BulkUpdateStepStatusesParams {
|
|
12
|
+
jobExecutionId: string;
|
|
13
|
+
status: Extract<StepStatus, 'failed' | 'cancelled'>;
|
|
14
|
+
}
|
|
15
|
+
export declare function bulkUpdateStepStatuses(params: BulkUpdateStepStatusesParams, tx?: Tx): Promise<void>;
|
|
16
|
+
export declare function getStepsByJobExecutionIdForUpdate(jobExecutionId: string, tx: Tx): Promise<Step[]>;
|
|
17
|
+
export declare function getStepAttemptsByJobExecutionId(jobExecutionId: string, tx: Tx): Promise<StepAttempt[]>;
|
|
18
|
+
export interface MarkStepRunningParams {
|
|
19
|
+
jobExecutionId: string;
|
|
20
|
+
stepId: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function markStepRunning(params: MarkStepRunningParams, tx: Tx): Promise<Step | null>;
|
|
23
|
+
export interface DispatchStepWithCompletedConfigParams {
|
|
24
|
+
jobExecutionId: string;
|
|
25
|
+
stepId: string;
|
|
26
|
+
config: Record<string, unknown>;
|
|
27
|
+
evaluationTrace: readonly PersistedEvaluationTraceEntry[] | null;
|
|
28
|
+
}
|
|
29
|
+
export declare function dispatchStepWithCompletedConfig(params: DispatchStepWithCompletedConfigParams, tx: Tx): Promise<Step | null>;
|
|
30
|
+
export interface MarkStepSkippedParams {
|
|
31
|
+
jobExecutionId: string;
|
|
32
|
+
stepId: string;
|
|
33
|
+
statusReason: StepStatusReason;
|
|
34
|
+
evaluationTrace: readonly PersistedEvaluationTraceEntry[];
|
|
35
|
+
}
|
|
36
|
+
export declare function markStepSkipped(params: MarkStepSkippedParams, tx: Tx): Promise<Step | null>;
|
|
37
|
+
export declare function settleJobFailed(tx: Tx, params: {
|
|
38
|
+
jobId: string;
|
|
39
|
+
jobExecutionId: string;
|
|
40
|
+
failedStepId: string;
|
|
41
|
+
error: Record<string, unknown>;
|
|
42
|
+
}): Promise<'succeeded' | 'failed' | null>;
|
|
43
|
+
export interface InsertRunningStepAttemptParams {
|
|
44
|
+
jobExecutionId: string;
|
|
45
|
+
stepId: string;
|
|
46
|
+
attempt: number;
|
|
47
|
+
config?: Record<string, unknown> | null;
|
|
48
|
+
evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null;
|
|
49
|
+
}
|
|
50
|
+
export declare function insertRunningStepAttempt(params: InsertRunningStepAttemptParams, tx: Tx): Promise<void>;
|
|
51
|
+
export interface FinishStepAttemptParams {
|
|
52
|
+
stepId: string;
|
|
53
|
+
attempt: number;
|
|
54
|
+
status: Exclude<StepAttemptStatus, 'running'>;
|
|
55
|
+
error?: Record<string, unknown> | null;
|
|
56
|
+
output?: Record<string, unknown> | null;
|
|
57
|
+
response?: string | null;
|
|
58
|
+
exitCode?: number | null;
|
|
59
|
+
logOutcome: LogOutcomeDto;
|
|
60
|
+
gateResult?: Record<string, unknown> | null;
|
|
61
|
+
restartFeedback?: string | null;
|
|
62
|
+
}
|
|
63
|
+
export declare function finishStepAttempt(params: FinishStepAttemptParams, tx: Tx): Promise<void>;
|
|
64
|
+
export interface RewindStepsToPendingParams {
|
|
65
|
+
jobExecutionId: string;
|
|
66
|
+
fromPosition: number;
|
|
67
|
+
}
|
|
68
|
+
export declare function rewindStepsToPending(params: RewindStepsToPendingParams, tx: Tx): Promise<void>;
|
|
69
|
+
export declare function countStepAttempts(stepId: string, tx: Tx): Promise<number>;
|
|
70
|
+
export declare function getStepAttempts(jobId: string): Promise<StepAttempt[]>;
|
|
71
|
+
export declare function getStepAttemptsByJobIds(jobIds: string[]): Promise<StepAttempt[]>;
|
|
72
|
+
export interface ApplyStepResultParams {
|
|
73
|
+
jobExecutionId: string;
|
|
74
|
+
stepId: string;
|
|
75
|
+
status: 'succeeded' | 'failed';
|
|
76
|
+
error: Record<string, unknown> | null;
|
|
77
|
+
}
|
|
78
|
+
export declare function applyStepResult(params: ApplyStepResultParams, tx: Tx): Promise<void>;
|
|
79
|
+
export interface CancelRemainingStepsParams {
|
|
80
|
+
jobExecutionId: string;
|
|
81
|
+
}
|
|
82
|
+
export declare function cancelRemainingSteps(params: CancelRemainingStepsParams, tx: Tx): Promise<void>;
|
|
83
|
+
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EACV,6BAA6B,EAC7B,IAAI,EACJ,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAK,KAAK,EAAE,EAAC,MAAM,UAAU,CAAC;AAOrC,wBAAsB,0BAA0B,CAAC,MAAM,EAAE;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAU5B;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAM3E;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAQpE;AAED,wBAAsB,wBAAwB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAOtF;AAED,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC;CACrD;AAED,wBAAsB,sBAAsB,CAC1C,MAA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