@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/metrics/instance.ts"],"sourcesContent":["import {instanceMetrics} from '@shipfox/node-opentelemetry';\nimport type {JobStatus, ResolutionReason} 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 {RuntimeCompletionStatus} from '#core/workflow-scheduling/runtime-dag.js';\n\nconst meter = instanceMetrics.getMeter('workflows');\n\nconst runCreatedCount = meter.createCounter<{provider: string}>('workflows_run_created', {\n description: 'Workflow runs created by bounded trigger provider',\n});\n\nconst runStatusChangedCount = meter.createCounter<{status: WorkflowRunStatus}>(\n 'workflows_run_status_changed',\n {description: 'Workflow run status transitions by resulting status'},\n);\n\nconst jobStatusChangedCount = meter.createCounter<{status: JobStatus}>(\n 'workflows_job_status_changed',\n {description: 'Workflow job status transitions by resulting status'},\n);\n\nconst jobExecutionStatusChangedCount = meter.createCounter<{status: JobExecutionStatus}>(\n 'workflows_job_execution_status_changed',\n {description: 'Workflow job execution status transitions by resulting status'},\n);\n\nconst jobExecutionQueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_queued',\n {\n description: 'Workflow job executions first marked as queued from runner queue events',\n },\n);\n\nconst jobExecutionStartedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_started',\n {\n description: 'Workflow job executions first marked as started from runner claim events',\n },\n);\n\nconst jobExecutionStepsSettledCount = meter.createCounter<{\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>;\n}>('workflows_job_execution_steps_settled', {\n description: 'Job execution steps-settled events enqueued by resulting completion status',\n});\n\nconst jobExecutionTimedOutCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_timed_out',\n {\n description: 'Workflow job executions failed by the execution orchestration timeout path',\n },\n);\n\nconst jobExecutionLeaseExpiryResolvedCount = meter.createCounter<{status: RuntimeCompletionStatus}>(\n 'workflows_job_execution_lease_expiry_resolved',\n {description: 'Runner lease-expiry resolutions by resulting runtime status'},\n);\n\nconst stepRestartEnqueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_step_restart_enqueued',\n {description: 'Durable step restart events enqueued after a restartable gate failure'},\n);\n\nconst listenerEventsReceivedCount = meter.createCounter<{provider: string}>(\n 'workflows_listener_events_received',\n {description: 'Listener integration events buffered by bounded trigger provider'},\n);\n\nconst listenerExecutionsCount = meter.createCounter<{\n outcome: 'succeeded' | 'failed' | 'cancelled';\n}>('workflows_listener_executions', {\n description: 'Listener job execution firings by terminal outcome',\n});\n\nconst listenerResolvedCount = meter.createCounter<{reason: ResolutionReason}>(\n 'workflows_listener_resolved',\n {description: 'Listener resolutions by bounded reason'},\n);\n\nconst agentToolWarningFailedCount = meter.createCounter<{\n reason: 'budget' | 'lookup' | 'write';\n}>('workflows_agent_tool_warning_failed', {\n description: 'Agent tool capability warning failures by bounded reason',\n});\n\nconst listenerEventsCoalesced = meter.createHistogram<Record<string, never>>(\n 'workflows_listener_events_coalesced',\n {\n description: 'Listener firing batch sizes',\n unit: '1',\n advice: {explicitBucketBoundaries: [1, 2, 5, 10, 25, 50, 100, 250]},\n },\n);\n\nexport function recordWorkflowRunCreated(provider: string): void {\n runCreatedCount.add(1, {provider});\n}\n\nexport function recordWorkflowRunStatusChanged(status: WorkflowRunStatus): void {\n runStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobStatusChanged(status: JobStatus): void {\n jobStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionStatusChanged(status: JobExecutionStatus): void {\n jobExecutionStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionQueued(): void {\n jobExecutionQueuedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStarted(): void {\n jobExecutionStartedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStepsSettled(\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>,\n): void {\n jobExecutionStepsSettledCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionTimedOut(): void {\n jobExecutionTimedOutCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionLeaseExpiryResolved(\n status: RuntimeCompletionStatus,\n): void {\n jobExecutionLeaseExpiryResolvedCount.add(1, {status});\n}\n\nexport function recordWorkflowStepRestartEnqueued(): void {\n stepRestartEnqueuedCount.add(1);\n}\n\nexport function recordListenerEventReceived(provider: string): void {\n listenerEventsReceivedCount.add(1, {provider});\n}\n\nexport function recordWorkflowListenerExecution(\n outcome: 'succeeded' | 'failed' | 'cancelled',\n): void {\n listenerExecutionsCount.add(1, {outcome});\n}\n\nexport function recordWorkflowListenerResolved(reason: ResolutionReason): void {\n listenerResolvedCount.add(1, {reason});\n}\n\nexport function recordListenerEventsCoalesced(batchSize: number): void {\n listenerEventsCoalesced.record(batchSize);\n}\n\nexport function recordWorkflowAgentToolWarningFailed(reason: 'budget' | 'lookup' | 'write'): void {\n agentToolWarningFailedCount.add(1, {reason});\n}\n"],"names":["instanceMetrics","meter","getMeter","runCreatedCount","createCounter","description","runStatusChangedCount","jobStatusChangedCount","jobExecutionStatusChangedCount","jobExecutionQueuedCount","jobExecutionStartedCount","jobExecutionStepsSettledCount","jobExecutionTimedOutCount","jobExecutionLeaseExpiryResolvedCount","stepRestartEnqueuedCount","listenerEventsReceivedCount","listenerExecutionsCount","listenerResolvedCount","agentToolWarningFailedCount","listenerEventsCoalesced","createHistogram","unit","advice","explicitBucketBoundaries","recordWorkflowRunCreated","provider","add","recordWorkflowRunStatusChanged","status","recordWorkflowJobStatusChanged","recordWorkflowJobExecutionStatusChanged","recordWorkflowJobExecutionQueued","recordWorkflowJobExecutionStarted","recordWorkflowJobExecutionStepsSettled","recordWorkflowJobExecutionTimedOut","recordWorkflowJobExecutionLeaseExpiryResolved","recordWorkflowStepRestartEnqueued","recordListenerEventReceived","recordWorkflowListenerExecution","outcome","recordWorkflowListenerResolved","reason","recordListenerEventsCoalesced","batchSize","record","recordWorkflowAgentToolWarningFailed"],"mappings":"AAAA,SAAQA,eAAe,QAAO,8BAA8B;AAM5D,MAAMC,QAAQD,gBAAgBE,QAAQ,CAAC;AAEvC,MAAMC,kBAAkBF,MAAMG,aAAa,CAAqB,yBAAyB;IACvFC,aAAa;AACf;AAEA,MAAMC,wBAAwBL,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAME,wBAAwBN,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMG,iCAAiCP,MAAMG,aAAa,CACxD,0CACA;IAACC,aAAa;AAA+D;AAG/E,MAAMI,0BAA0BR,MAAMG,aAAa,CACjD,kCACA;IACEC,aAAa;AACf;AAGF,MAAMK,2BAA2BT,MAAMG,aAAa,CAClD,mCACA;IACEC,aAAa;AACf;AAGF,MAAMM,gCAAgCV,MAAMG,aAAa,CAEtD,yCAAyC;IAC1CC,aAAa;AACf;AAEA,MAAMO,4BAA4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AA0Bc,GAAG,CAAC;AAChC;AAEA,OAAO,SAASS,8CACdP,MAA+B;IAE/Bf,qCAAqCa,GAAG,CAAC,GAAG;QAACE;IAAM;AACrD;AAEA,OAAO,SAASQ;IACdtB,yBAAyBY,GAAG,CAAC;AAC/B;AAEA,OAAO,SAASW,4BAA4BZ,QAAgB;IAC1DV,4BAA4BW,GAAG,CAAC,GAAG;QAACD;IAAQ;AAC9C;AAEA,OAAO,SAASa,gCACdC,OAA6C;IAE7CvB,wBAAwBU,GAAG,CAAC,GAAG;QAACa;IAAO;AACzC;AAEA,OAAO,SAASC,+BAA+BC,MAAwB;IACrExB,sBAAsBS,GAAG,CAAC,GAAG;QAACe;IAAM;AACtC;AAEA,OAAO,SAASC,8BAA8BC,SAAiB;IAC7DxB,wBAAwByB,MAAM,CAACD;AACjC;AAEA,OAAO,SAASE,qCAAqCJ,MAAqC;IACxFvB,4BAA4BQ,GAAG,CAAC,GAAG;QAACe;IAAM;AAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/metrics/service.ts"],"names":[],"mappings":"AAIA,wBAAgB,+BAA+B,IAAI,IAAI,CAyBtD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getServiceMetricsProvider } from '@shipfox/node-opentelemetry';
|
|
2
|
+
import { countActiveListeners } from '#db/job-listeners.js';
|
|
3
|
+
import { getWorkflowJobExecutionDepth } from '#db/workflow-runs.js';
|
|
4
|
+
export function registerWorkflowsServiceMetrics() {
|
|
5
|
+
const meter = getServiceMetricsProvider().getMeter('workflows');
|
|
6
|
+
const runningRuns = meter.createObservableGauge('workflows_running_runs', {
|
|
7
|
+
description: 'Workflow runs currently marked running'
|
|
8
|
+
});
|
|
9
|
+
const runningJobExecutions = meter.createObservableGauge('workflows_running_job_executions', {
|
|
10
|
+
description: 'Workflow job executions currently marked running'
|
|
11
|
+
});
|
|
12
|
+
const activeListeners = meter.createObservableGauge('workflows_active_listeners', {
|
|
13
|
+
description: 'Workflow jobs currently marked as listening'
|
|
14
|
+
});
|
|
15
|
+
meter.addBatchObservableCallback(async (observer)=>{
|
|
16
|
+
const [depth, listenerCount] = await Promise.all([
|
|
17
|
+
getWorkflowJobExecutionDepth(),
|
|
18
|
+
countActiveListeners()
|
|
19
|
+
]);
|
|
20
|
+
observer.observe(runningRuns, depth.runningRuns);
|
|
21
|
+
observer.observe(runningJobExecutions, depth.runningJobExecutions);
|
|
22
|
+
observer.observe(activeListeners, listenerCount);
|
|
23
|
+
}, [
|
|
24
|
+
runningRuns,
|
|
25
|
+
runningJobExecutions,
|
|
26
|
+
activeListeners
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/metrics/service.ts"],"sourcesContent":["import {getServiceMetricsProvider} from '@shipfox/node-opentelemetry';\nimport {countActiveListeners} from '#db/job-listeners.js';\nimport {getWorkflowJobExecutionDepth} from '#db/workflow-runs.js';\n\nexport function registerWorkflowsServiceMetrics(): void {\n const meter = getServiceMetricsProvider().getMeter('workflows');\n\n const runningRuns = meter.createObservableGauge('workflows_running_runs', {\n description: 'Workflow runs currently marked running',\n });\n const runningJobExecutions = meter.createObservableGauge('workflows_running_job_executions', {\n description: 'Workflow job executions currently marked running',\n });\n const activeListeners = meter.createObservableGauge('workflows_active_listeners', {\n description: 'Workflow jobs currently marked as listening',\n });\n\n meter.addBatchObservableCallback(\n async (observer) => {\n const [depth, listenerCount] = await Promise.all([\n getWorkflowJobExecutionDepth(),\n countActiveListeners(),\n ]);\n observer.observe(runningRuns, depth.runningRuns);\n observer.observe(runningJobExecutions, depth.runningJobExecutions);\n observer.observe(activeListeners, listenerCount);\n },\n [runningRuns, runningJobExecutions, activeListeners],\n );\n}\n"],"names":["getServiceMetricsProvider","countActiveListeners","getWorkflowJobExecutionDepth","registerWorkflowsServiceMetrics","meter","getMeter","runningRuns","createObservableGauge","description","runningJobExecutions","activeListeners","addBatchObservableCallback","observer","depth","listenerCount","Promise","all","observe"],"mappings":"AAAA,SAAQA,yBAAyB,QAAO,8BAA8B;AACtE,SAAQC,oBAAoB,QAAO,uBAAuB;AAC1D,SAAQC,4BAA4B,QAAO,uBAAuB;AAElE,OAAO,SAASC;IACd,MAAMC,QAAQJ,4BAA4BK,QAAQ,CAAC;IAEnD,MAAMC,cAAcF,MAAMG,qBAAqB,CAAC,0BAA0B;QACxEC,aAAa;IACf;IACA,MAAMC,uBAAuBL,MAAMG,qBAAqB,CAAC,oCAAoC;QAC3FC,aAAa;IACf;IACA,MAAME,kBAAkBN,MAAMG,qBAAqB,CAAC,8BAA8B;QAChFC,aAAa;IACf;IAEAJ,MAAMO,0BAA0B,CAC9B,OAAOC;QACL,MAAM,CAACC,OAAOC,cAAc,GAAG,MAAMC,QAAQC,GAAG,CAAC;YAC/Cd;YACAD;SACD;QACDW,SAASK,OAAO,CAACX,aAAaO,MAAMP,WAAW;QAC/CM,SAASK,OAAO,CAACR,sBAAsBI,MAAMJ,oBAAoB;QACjEG,SAASK,OAAO,CAACP,iBAAiBI;IACpC,GACA;QAACR;QAAaG;QAAsBC;KAAgB;AAExD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CheckoutSpec } from '@shipfox/api-integration-core';
|
|
2
|
+
import type { CheckoutTokenResponseDto } from '@shipfox/api-workflows-dto';
|
|
3
|
+
export declare function toCheckoutTokenDto(spec: CheckoutSpec, options: {
|
|
4
|
+
persist: boolean;
|
|
5
|
+
}): CheckoutTokenResponseDto;
|
|
6
|
+
//# sourceMappingURL=checkout-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout-token.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/checkout-token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAwCzE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,GAC1B,wBAAwB,CA0B1B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const SCP_LIKE_HOST_RE = /^(?:[^@:/]+@)?([^:/]+):/;
|
|
2
|
+
// Defense in depth: createCheckoutSpec's contract is that `repositoryUrl` never
|
|
3
|
+
// embeds credentials (they live in `credentials` so redaction can mask them). A
|
|
4
|
+
// provider bug that put a token in the URL would bypass redaction and leak it
|
|
5
|
+
// into `git remote -v` and logs, so reject it before it reaches the runner.
|
|
6
|
+
function assertNoEmbeddedCredentials(repositoryUrl) {
|
|
7
|
+
// Run the scp-style check unconditionally: a genuine scp form
|
|
8
|
+
// (git@host:org/repo.git) fails URL parsing, but a `user:secret@host:path`
|
|
9
|
+
// string parses with a bogus `user:` scheme and *empty* URL userinfo, so the
|
|
10
|
+
// url.username check below would miss its embedded password.
|
|
11
|
+
assertNoScpCredentials(repositoryUrl);
|
|
12
|
+
let url;
|
|
13
|
+
try {
|
|
14
|
+
url = new URL(repositoryUrl);
|
|
15
|
+
} catch {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (url.username || url.password) {
|
|
19
|
+
throw new Error('Checkout repository URL must not embed credentials');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// scp-like userinfo is everything before the first `@`, and that `@` precedes
|
|
23
|
+
// the first `/`. A bare `git@host:path` user is fine; a `user:secret@host:path`
|
|
24
|
+
// password embeds a credential, so reject any colon in the userinfo segment.
|
|
25
|
+
function assertNoScpCredentials(repositoryUrl) {
|
|
26
|
+
const atIndex = repositoryUrl.indexOf('@');
|
|
27
|
+
const slashIndex = repositoryUrl.indexOf('/');
|
|
28
|
+
if (atIndex === -1 || slashIndex !== -1 && atIndex > slashIndex) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (repositoryUrl.slice(0, atIndex).includes(':')) {
|
|
32
|
+
throw new Error('Checkout repository URL must not embed credentials');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function toCheckoutTokenDto(spec, options) {
|
|
36
|
+
assertNoEmbeddedCredentials(spec.repositoryUrl);
|
|
37
|
+
// Every provider that returns credentials uses a username (GitHub:
|
|
38
|
+
// 'x-access-token'), so the response is always basic auth; a credential-free
|
|
39
|
+
// spec (debug) omits auth entirely.
|
|
40
|
+
return {
|
|
41
|
+
repository_url: spec.repositoryUrl,
|
|
42
|
+
ref: spec.ref,
|
|
43
|
+
...spec.gitAuthor ? {
|
|
44
|
+
git_author: {
|
|
45
|
+
name: spec.gitAuthor.name,
|
|
46
|
+
email: spec.gitAuthor.email
|
|
47
|
+
}
|
|
48
|
+
} : {},
|
|
49
|
+
...spec.credentials ? {
|
|
50
|
+
auth: {
|
|
51
|
+
kind: 'basic',
|
|
52
|
+
username: spec.credentials.username,
|
|
53
|
+
token: spec.credentials.token,
|
|
54
|
+
expires_at: spec.credentials.expiresAt.toISOString(),
|
|
55
|
+
carry: 'header',
|
|
56
|
+
host: checkoutHost(spec.repositoryUrl),
|
|
57
|
+
persist: options.persist
|
|
58
|
+
}
|
|
59
|
+
} : {}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function checkoutHost(repositoryUrl) {
|
|
63
|
+
try {
|
|
64
|
+
const host = new URL(repositoryUrl).host;
|
|
65
|
+
if (host) return host;
|
|
66
|
+
} catch {
|
|
67
|
+
// Fall through to scp-like parsing.
|
|
68
|
+
}
|
|
69
|
+
const scpLike = SCP_LIKE_HOST_RE.exec(repositoryUrl);
|
|
70
|
+
if (scpLike?.[1]) return scpLike[1];
|
|
71
|
+
throw new Error('Checkout repository URL must include a host');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=checkout-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/checkout-token.ts"],"sourcesContent":["import type {CheckoutSpec} from '@shipfox/api-integration-core';\nimport type {CheckoutTokenResponseDto} from '@shipfox/api-workflows-dto';\n\nconst SCP_LIKE_HOST_RE = /^(?:[^@:/]+@)?([^:/]+):/;\n\n// Defense in depth: createCheckoutSpec's contract is that `repositoryUrl` never\n// embeds credentials (they live in `credentials` so redaction can mask them). A\n// provider bug that put a token in the URL would bypass redaction and leak it\n// into `git remote -v` and logs, so reject it before it reaches the runner.\nfunction assertNoEmbeddedCredentials(repositoryUrl: string): void {\n // Run the scp-style check unconditionally: a genuine scp form\n // (git@host:org/repo.git) fails URL parsing, but a `user:secret@host:path`\n // string parses with a bogus `user:` scheme and *empty* URL userinfo, so the\n // url.username check below would miss its embedded password.\n assertNoScpCredentials(repositoryUrl);\n\n let url: URL;\n try {\n url = new URL(repositoryUrl);\n } catch {\n return;\n }\n if (url.username || url.password) {\n throw new Error('Checkout repository URL must not embed credentials');\n }\n}\n\n// scp-like userinfo is everything before the first `@`, and that `@` precedes\n// the first `/`. A bare `git@host:path` user is fine; a `user:secret@host:path`\n// password embeds a credential, so reject any colon in the userinfo segment.\nfunction assertNoScpCredentials(repositoryUrl: string): void {\n const atIndex = repositoryUrl.indexOf('@');\n const slashIndex = repositoryUrl.indexOf('/');\n if (atIndex === -1 || (slashIndex !== -1 && atIndex > slashIndex)) {\n return;\n }\n if (repositoryUrl.slice(0, atIndex).includes(':')) {\n throw new Error('Checkout repository URL must not embed credentials');\n }\n}\n\nexport function toCheckoutTokenDto(\n spec: CheckoutSpec,\n options: {persist: boolean},\n): CheckoutTokenResponseDto {\n assertNoEmbeddedCredentials(spec.repositoryUrl);\n\n // Every provider that returns credentials uses a username (GitHub:\n // 'x-access-token'), so the response is always basic auth; a credential-free\n // spec (debug) omits auth entirely.\n return {\n repository_url: spec.repositoryUrl,\n ref: spec.ref,\n ...(spec.gitAuthor\n ? {git_author: {name: spec.gitAuthor.name, email: spec.gitAuthor.email}}\n : {}),\n ...(spec.credentials\n ? {\n auth: {\n kind: 'basic' as const,\n username: spec.credentials.username,\n token: spec.credentials.token,\n expires_at: spec.credentials.expiresAt.toISOString(),\n carry: 'header' as const,\n host: checkoutHost(spec.repositoryUrl),\n persist: options.persist,\n },\n }\n : {}),\n };\n}\n\nfunction checkoutHost(repositoryUrl: string): string {\n try {\n const host = new URL(repositoryUrl).host;\n if (host) return host;\n } catch {\n // Fall through to scp-like parsing.\n }\n\n const scpLike = SCP_LIKE_HOST_RE.exec(repositoryUrl);\n if (scpLike?.[1]) return scpLike[1];\n\n throw new Error('Checkout repository URL must include a host');\n}\n"],"names":["SCP_LIKE_HOST_RE","assertNoEmbeddedCredentials","repositoryUrl","assertNoScpCredentials","url","URL","username","password","Error","atIndex","indexOf","slashIndex","slice","includes","toCheckoutTokenDto","spec","options","repository_url","ref","gitAuthor","git_author","name","email","credentials","auth","kind","token","expires_at","expiresAt","toISOString","carry","host","checkoutHost","persist","scpLike","exec"],"mappings":"AAGA,MAAMA,mBAAmB;AAEzB,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,4EAA4E;AAC5E,SAASC,4BAA4BC,aAAqB;IACxD,8DAA8D;IAC9D,2EAA2E;IAC3E,6EAA6E;IAC7E,6DAA6D;IAC7DC,uBAAuBD;IAEvB,IAAIE;IACJ,IAAI;QACFA,MAAM,IAAIC,IAAIH;IAChB,EAAE,OAAM;QACN;IACF;IACA,IAAIE,IAAIE,QAAQ,IAAIF,IAAIG,QAAQ,EAAE;QAChC,MAAM,IAAIC,MAAM;IAClB;AACF;AAEA,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,SAASL,uBAAuBD,aAAqB;IACnD,MAAMO,UAAUP,cAAcQ,OAAO,CAAC;IACtC,MAAMC,aAAaT,cAAcQ,OAAO,CAAC;IACzC,IAAID,YAAY,CAAC,KAAME,eAAe,CAAC,KAAKF,UAAUE,YAAa;QACjE;IACF;IACA,IAAIT,cAAcU,KAAK,CAAC,GAAGH,SAASI,QAAQ,CAAC,MAAM;QACjD,MAAM,IAAIL,MAAM;IAClB;AACF;AAEA,OAAO,SAASM,mBACdC,IAAkB,EAClBC,OAA2B;IAE3Bf,4BAA4Bc,KAAKb,aAAa;IAE9C,mEAAmE;IACnE,6EAA6E;IAC7E,oCAAoC;IACpC,OAAO;QACLe,gBAAgBF,KAAKb,aAAa;QAClCgB,KAAKH,KAAKG,GAAG;QACb,GAAIH,KAAKI,SAAS,GACd;YAACC,YAAY;gBAACC,MAAMN,KAAKI,SAAS,CAACE,IAAI;gBAAEC,OAAOP,KAAKI,SAAS,CAACG,KAAK;YAAA;QAAC,IACrE,CAAC,CAAC;QACN,GAAIP,KAAKQ,WAAW,GAChB;YACEC,MAAM;gBACJC,MAAM;gBACNnB,UAAUS,KAAKQ,WAAW,CAACjB,QAAQ;gBACnCoB,OAAOX,KAAKQ,WAAW,CAACG,KAAK;gBAC7BC,YAAYZ,KAAKQ,WAAW,CAACK,SAAS,CAACC,WAAW;gBAClDC,OAAO;gBACPC,MAAMC,aAAajB,KAAKb,aAAa;gBACrC+B,SAASjB,QAAQiB,OAAO;YAC1B;QACF,IACA,CAAC,CAAC;IACR;AACF;AAEA,SAASD,aAAa9B,aAAqB;IACzC,IAAI;QACF,MAAM6B,OAAO,IAAI1B,IAAIH,eAAe6B,IAAI;QACxC,IAAIA,MAAM,OAAOA;IACnB,EAAE,OAAM;IACN,oCAAoC;IACtC;IAEA,MAAMG,UAAUlC,iBAAiBmC,IAAI,CAACjC;IACtC,IAAIgC,SAAS,CAAC,EAAE,EAAE,OAAOA,OAAO,CAAC,EAAE;IAEnC,MAAM,IAAI1B,MAAM;AAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AACtD,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/index.ts"],"sourcesContent":["export {toJobDto, toJobExecutionDto} from './job.js';\nexport {toStepAttemptDto, toStepDto} from './step.js';\nexport {toRunAttemptDto, toRunDto} from './workflow-run.js';\n"],"names":["toJobDto","toJobExecutionDto","toStepAttemptDto","toStepDto","toRunAttemptDto","toRunDto"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,iBAAiB,QAAO,WAAW;AACrD,SAAQC,gBAAgB,EAAEC,SAAS,QAAO,YAAY;AACtD,SAAQC,eAAe,EAAEC,QAAQ,QAAO,oBAAoB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JobDto, JobExecutionDto } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import type { Job } from '#core/entities/job.js';
|
|
3
|
+
import type { JobExecution } from '#core/entities/job-execution.js';
|
|
4
|
+
export declare function toJobDto(job: Job): JobDto;
|
|
5
|
+
export declare function toJobExecutionDto(jobExecution: JobExecution): JobExecutionDto;
|
|
6
|
+
//# sourceMappingURL=job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAElE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAwCzC;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,eAAe,CAiB7E"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export function toJobDto(job) {
|
|
2
|
+
return {
|
|
3
|
+
id: job.id,
|
|
4
|
+
run_attempt_id: job.workflowRunAttemptId,
|
|
5
|
+
key: job.key,
|
|
6
|
+
name: job.name,
|
|
7
|
+
mode: job.mode,
|
|
8
|
+
status: job.status,
|
|
9
|
+
status_reason: job.statusReason,
|
|
10
|
+
carried_over: job.carriedOver,
|
|
11
|
+
listening: job.listeningOn === null ? null : {
|
|
12
|
+
on: job.listeningOn,
|
|
13
|
+
until: job.listeningUntil,
|
|
14
|
+
timeout_ms: job.listeningTimeoutMs,
|
|
15
|
+
max_executions: job.maxExecutions,
|
|
16
|
+
batch: job.batchDebounceMs === null && job.batchMaxSize === null && job.batchMaxWaitMs === null ? null : {
|
|
17
|
+
...job.batchDebounceMs === null ? {} : {
|
|
18
|
+
debounce_ms: job.batchDebounceMs
|
|
19
|
+
},
|
|
20
|
+
...job.batchMaxSize === null ? {} : {
|
|
21
|
+
max_size: job.batchMaxSize
|
|
22
|
+
},
|
|
23
|
+
...job.batchMaxWaitMs === null ? {} : {
|
|
24
|
+
max_wait_ms: job.batchMaxWaitMs
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
on_resolve: job.onResolve ?? 'finish',
|
|
28
|
+
execution_timeout_ms: job.executionTimeoutMs ?? null,
|
|
29
|
+
name: job.name
|
|
30
|
+
},
|
|
31
|
+
listener_status: job.listenerStatus,
|
|
32
|
+
resolution_reason: job.resolutionReason,
|
|
33
|
+
outputs: job.outputs,
|
|
34
|
+
dependencies: job.dependencies,
|
|
35
|
+
position: job.position,
|
|
36
|
+
created_at: job.createdAt.toISOString(),
|
|
37
|
+
updated_at: job.updatedAt.toISOString()
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function toJobExecutionDto(jobExecution) {
|
|
41
|
+
return {
|
|
42
|
+
id: jobExecution.id,
|
|
43
|
+
job_id: jobExecution.jobId,
|
|
44
|
+
sequence: jobExecution.sequence,
|
|
45
|
+
name: jobExecution.name,
|
|
46
|
+
status: jobExecution.status,
|
|
47
|
+
status_reason: jobExecution.statusReason,
|
|
48
|
+
trigger_events: jobExecution.triggerEvents,
|
|
49
|
+
outputs: jobExecution.outputs,
|
|
50
|
+
queued_at: jobExecution.queuedAt?.toISOString() ?? null,
|
|
51
|
+
started_at: jobExecution.startedAt?.toISOString() ?? null,
|
|
52
|
+
finished_at: jobExecution.finishedAt?.toISOString() ?? null,
|
|
53
|
+
timed_out_at: jobExecution.timedOutAt?.toISOString() ?? null,
|
|
54
|
+
created_at: jobExecution.createdAt.toISOString(),
|
|
55
|
+
updated_at: jobExecution.updatedAt.toISOString()
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=job.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/job.ts"],"sourcesContent":["import type {JobDto, JobExecutionDto} from '@shipfox/api-workflows-dto';\nimport type {Job} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\n\nexport function toJobDto(job: Job): JobDto {\n return {\n id: job.id,\n run_attempt_id: job.workflowRunAttemptId,\n key: job.key,\n name: job.name,\n mode: job.mode,\n status: job.status,\n status_reason: job.statusReason,\n carried_over: job.carriedOver,\n listening:\n job.listeningOn === null\n ? null\n : {\n on: job.listeningOn,\n until: job.listeningUntil,\n timeout_ms: job.listeningTimeoutMs,\n max_executions: job.maxExecutions,\n batch:\n job.batchDebounceMs === null &&\n job.batchMaxSize === null &&\n job.batchMaxWaitMs === null\n ? null\n : {\n ...(job.batchDebounceMs === null ? {} : {debounce_ms: job.batchDebounceMs}),\n ...(job.batchMaxSize === null ? {} : {max_size: job.batchMaxSize}),\n ...(job.batchMaxWaitMs === null ? {} : {max_wait_ms: job.batchMaxWaitMs}),\n },\n on_resolve: job.onResolve ?? 'finish',\n execution_timeout_ms: job.executionTimeoutMs ?? null,\n name: job.name,\n },\n listener_status: job.listenerStatus,\n resolution_reason: job.resolutionReason,\n outputs: job.outputs,\n dependencies: job.dependencies,\n position: job.position,\n created_at: job.createdAt.toISOString(),\n updated_at: job.updatedAt.toISOString(),\n };\n}\n\nexport function toJobExecutionDto(jobExecution: JobExecution): JobExecutionDto {\n return {\n id: jobExecution.id,\n job_id: jobExecution.jobId,\n sequence: jobExecution.sequence,\n name: jobExecution.name,\n status: jobExecution.status,\n status_reason: jobExecution.statusReason,\n trigger_events: jobExecution.triggerEvents,\n outputs: jobExecution.outputs,\n queued_at: jobExecution.queuedAt?.toISOString() ?? null,\n started_at: jobExecution.startedAt?.toISOString() ?? null,\n finished_at: jobExecution.finishedAt?.toISOString() ?? null,\n timed_out_at: jobExecution.timedOutAt?.toISOString() ?? null,\n created_at: jobExecution.createdAt.toISOString(),\n updated_at: jobExecution.updatedAt.toISOString(),\n };\n}\n"],"names":["toJobDto","job","id","run_attempt_id","workflowRunAttemptId","key","name","mode","status","status_reason","statusReason","carried_over","carriedOver","listening","listeningOn","on","until","listeningUntil","timeout_ms","listeningTimeoutMs","max_executions","maxExecutions","batch","batchDebounceMs","batchMaxSize","batchMaxWaitMs","debounce_ms","max_size","max_wait_ms","on_resolve","onResolve","execution_timeout_ms","executionTimeoutMs","listener_status","listenerStatus","resolution_reason","resolutionReason","outputs","dependencies","position","created_at","createdAt","toISOString","updated_at","updatedAt","toJobExecutionDto","jobExecution","job_id","jobId","sequence","trigger_events","triggerEvents","queued_at","queuedAt","started_at","startedAt","finished_at","finishedAt","timed_out_at","timedOutAt"],"mappings":"AAIA,OAAO,SAASA,SAASC,GAAQ;IAC/B,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,gBAAgBF,IAAIG,oBAAoB;QACxCC,KAAKJ,IAAII,GAAG;QACZC,MAAML,IAAIK,IAAI;QACdC,MAAMN,IAAIM,IAAI;QACdC,QAAQP,IAAIO,MAAM;QAClBC,eAAeR,IAAIS,YAAY;QAC/BC,cAA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O;QAC7Be,WAAWN,aAAaO,QAAQ,EAAEX,iBAAiB;QACnDY,YAAYR,aAAaS,SAAS,EAAEb,iBAAiB;QACrDc,aAAaV,aAAaW,UAAU,EAAEf,iBAAiB;QACvDgB,cAAcZ,aAAaa,UAAU,EAAEjB,iBAAiB;QACxDF,YAAYM,aAAaL,SAAS,CAACC,WAAW;QAC9CC,YAAYG,aAAaF,SAAS,CAACF,WAAW;IAChD;AACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type StepAttemptDto, type StepDto, type StepErrorDto } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import type { Step, StepAttempt } from '#core/entities/step.js';
|
|
3
|
+
export declare function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null;
|
|
4
|
+
export declare function toStepDto(step: Step): StepDto;
|
|
5
|
+
export declare function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto;
|
|
6
|
+
//# sourceMappingURL=step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,OAAO,EAEZ,KAAK,YAAY,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAmC9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAahG;AA0CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAgB7C;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiBrE"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { agentConfigIssueSchema, stepErrorReasonSchema } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import { GATE_EVALUATION_ERROR_REASON } from '#core/step-transition/evaluate-gate.js';
|
|
3
|
+
// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner
|
|
4
|
+
// contract rather than trusting whatever shape the row happens to hold. `category`
|
|
5
|
+
// is not stored on the row; the caller derives it from the step type and passes it
|
|
6
|
+
// in (server-authoritative, never trusted from the runner).
|
|
7
|
+
function toStepErrorDto(error, category) {
|
|
8
|
+
if (error === null) return null;
|
|
9
|
+
const message = typeof error.message === 'string' ? error.message : '';
|
|
10
|
+
const exitCode = error.exitCode;
|
|
11
|
+
const signal = typeof error.signal === 'string' ? error.signal : undefined;
|
|
12
|
+
const field = typeof error.field === 'string' ? error.field : undefined;
|
|
13
|
+
const source = typeof error.source === 'string' ? error.source : undefined;
|
|
14
|
+
const reason = stepErrorReasonSchema.safeParse(error.reason);
|
|
15
|
+
const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);
|
|
16
|
+
return {
|
|
17
|
+
message,
|
|
18
|
+
...exitCode === null || typeof exitCode === 'number' ? {
|
|
19
|
+
exit_code: exitCode
|
|
20
|
+
} : {},
|
|
21
|
+
...signal === undefined ? {} : {
|
|
22
|
+
signal
|
|
23
|
+
},
|
|
24
|
+
...reason.success ? {
|
|
25
|
+
reason: reason.data
|
|
26
|
+
} : {},
|
|
27
|
+
...field === undefined ? {} : {
|
|
28
|
+
field
|
|
29
|
+
},
|
|
30
|
+
...source === undefined ? {} : {
|
|
31
|
+
source
|
|
32
|
+
},
|
|
33
|
+
...agentConfigIssue.success ? {
|
|
34
|
+
agent_config_issue: agentConfigIssue.data
|
|
35
|
+
} : {},
|
|
36
|
+
category
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Inverse of toStepErrorDto: reported wire errors land on the domain row in
|
|
40
|
+
// camelCase so the read path renders them back without a special case. `category`
|
|
41
|
+
// is intentionally NOT persisted — the server derives it from the step type on
|
|
42
|
+
// read, so a runner-supplied category is ignored here.
|
|
43
|
+
export function fromStepErrorDto(error) {
|
|
44
|
+
if (!error) return null;
|
|
45
|
+
return {
|
|
46
|
+
message: error.message,
|
|
47
|
+
...error.exit_code === null || typeof error.exit_code === 'number' ? {
|
|
48
|
+
exitCode: error.exit_code
|
|
49
|
+
} : {},
|
|
50
|
+
...typeof error.signal === 'string' ? {
|
|
51
|
+
signal: error.signal
|
|
52
|
+
} : {},
|
|
53
|
+
...error.reason === undefined ? {} : {
|
|
54
|
+
reason: error.reason
|
|
55
|
+
},
|
|
56
|
+
...error.field === undefined ? {} : {
|
|
57
|
+
field: error.field
|
|
58
|
+
},
|
|
59
|
+
...error.source === undefined ? {} : {
|
|
60
|
+
source: error.source
|
|
61
|
+
},
|
|
62
|
+
...error.agent_config_issue === undefined ? {} : {
|
|
63
|
+
agentConfigIssue: error.agent_config_issue
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function isIntOrNull(value) {
|
|
68
|
+
return value === null || typeof value === 'number' && Number.isInteger(value);
|
|
69
|
+
}
|
|
70
|
+
function toStepGateResultDto(gateResult, status) {
|
|
71
|
+
if (gateResult === null) {
|
|
72
|
+
return status === 'running' || status === 'pending' ? {
|
|
73
|
+
kind: 'not_evaluated'
|
|
74
|
+
} : {
|
|
75
|
+
kind: 'none'
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const exitCode = gateResult.exit_code;
|
|
79
|
+
const passed = gateResult.passed;
|
|
80
|
+
const source = gateResult.source;
|
|
81
|
+
const reason = gateResult.reason;
|
|
82
|
+
if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {
|
|
83
|
+
return {
|
|
84
|
+
kind: 'passed',
|
|
85
|
+
passed,
|
|
86
|
+
source,
|
|
87
|
+
exit_code: exitCode
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (passed === false && gateResult.uncheckable === true && typeof reason === 'string' && isIntOrNull(exitCode)) {
|
|
91
|
+
if (reason === GATE_EVALUATION_ERROR_REASON) {
|
|
92
|
+
return {
|
|
93
|
+
kind: 'evaluation_error',
|
|
94
|
+
reason,
|
|
95
|
+
exit_code: exitCode
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
kind: 'uncheckable',
|
|
100
|
+
passed,
|
|
101
|
+
uncheckable: true,
|
|
102
|
+
reason,
|
|
103
|
+
exit_code: exitCode
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {
|
|
107
|
+
return {
|
|
108
|
+
kind: 'failed',
|
|
109
|
+
passed,
|
|
110
|
+
source,
|
|
111
|
+
exit_code: exitCode
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
kind: 'unknown',
|
|
116
|
+
data: gateResult
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function toStepDto(step) {
|
|
120
|
+
return {
|
|
121
|
+
id: step.id,
|
|
122
|
+
job_execution_id: step.jobExecutionId,
|
|
123
|
+
key: step.key,
|
|
124
|
+
name: step.name,
|
|
125
|
+
source_location: toStepSourceLocationDto(step.sourceLocation),
|
|
126
|
+
status: step.status,
|
|
127
|
+
type: step.type,
|
|
128
|
+
config: step.config,
|
|
129
|
+
error: toStepErrorDto(step.error, step.type === 'setup' ? 'setup' : 'user'),
|
|
130
|
+
position: step.position,
|
|
131
|
+
current_attempt: step.currentAttempt,
|
|
132
|
+
created_at: step.createdAt.toISOString(),
|
|
133
|
+
updated_at: step.updatedAt.toISOString()
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function toStepSourceLocationDto(sourceLocation) {
|
|
137
|
+
if (sourceLocation === null) return null;
|
|
138
|
+
return {
|
|
139
|
+
start_line: sourceLocation.startLine,
|
|
140
|
+
end_line: sourceLocation.endLine
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export function toStepAttemptDto(attempt) {
|
|
144
|
+
return {
|
|
145
|
+
id: attempt.id,
|
|
146
|
+
step_id: attempt.stepId,
|
|
147
|
+
attempt: attempt.attempt,
|
|
148
|
+
execution_order: attempt.executionOrder,
|
|
149
|
+
status: attempt.status,
|
|
150
|
+
exit_code: attempt.exitCode,
|
|
151
|
+
output: attempt.output,
|
|
152
|
+
outputs: attempt.output,
|
|
153
|
+
response: attempt.response,
|
|
154
|
+
error: attempt.error,
|
|
155
|
+
gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),
|
|
156
|
+
restart_feedback: attempt.restartFeedback,
|
|
157
|
+
started_at: attempt.startedAt.toISOString(),
|
|
158
|
+
finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
//# sourceMappingURL=step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/step.ts"],"sourcesContent":["import {\n agentConfigIssueSchema,\n type StepAttemptDto,\n type StepDto,\n type StepErrorCategoryDto,\n type StepErrorDto,\n type StepGateResultDto,\n stepErrorReasonSchema,\n} from '@shipfox/api-workflows-dto';\nimport type {Step, StepAttempt} from '#core/entities/step.js';\nimport {GATE_EVALUATION_ERROR_REASON} from '#core/step-transition/evaluate-gate.js';\n\n// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner\n// contract rather than trusting whatever shape the row happens to hold. `category`\n// is not stored on the row; the caller derives it from the step type and passes it\n// in (server-authoritative, never trusted from the runner).\nfunction toStepErrorDto(\n error: Record<string, unknown> | null,\n category: StepErrorCategoryDto,\n): StepErrorDto {\n if (error === null) return null;\n const message = typeof error.message === 'string' ? error.message : '';\n const exitCode = error.exitCode;\n const signal = typeof error.signal === 'string' ? error.signal : undefined;\n const field = typeof error.field === 'string' ? error.field : undefined;\n const source = typeof error.source === 'string' ? error.source : undefined;\n const reason = stepErrorReasonSchema.safeParse(error.reason);\n const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);\n return {\n message,\n ...(exitCode === null || typeof exitCode === 'number' ? {exit_code: exitCode} : {}),\n ...(signal === undefined ? {} : {signal}),\n ...(reason.success ? {reason: reason.data} : {}),\n ...(field === undefined ? {} : {field}),\n ...(source === undefined ? {} : {source}),\n ...(agentConfigIssue.success ? {agent_config_issue: agentConfigIssue.data} : {}),\n category,\n };\n}\n\n// Inverse of toStepErrorDto: reported wire errors land on the domain row in\n// camelCase so the read path renders them back without a special case. `category`\n// is intentionally NOT persisted — the server derives it from the step type on\n// read, so a runner-supplied category is ignored here.\nexport function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null {\n if (!error) return null;\n return {\n message: error.message,\n ...(error.exit_code === null || typeof error.exit_code === 'number'\n ? {exitCode: error.exit_code}\n : {}),\n ...(typeof error.signal === 'string' ? {signal: error.signal} : {}),\n ...(error.reason === undefined ? {} : {reason: error.reason}),\n ...(error.field === undefined ? {} : {field: error.field}),\n ...(error.source === undefined ? {} : {source: error.source}),\n ...(error.agent_config_issue === undefined ? {} : {agentConfigIssue: error.agent_config_issue}),\n };\n}\n\nfunction isIntOrNull(value: unknown): value is number | null {\n return value === null || (typeof value === 'number' && Number.isInteger(value));\n}\n\nfunction toStepGateResultDto(\n gateResult: Record<string, unknown> | null,\n status: string,\n): StepGateResultDto {\n if (gateResult === null) {\n return status === 'running' || status === 'pending' ? {kind: 'not_evaluated'} : {kind: 'none'};\n }\n\n const exitCode = gateResult.exit_code;\n const passed = gateResult.passed;\n const source = gateResult.source;\n const reason = gateResult.reason;\n\n if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'passed', passed, source, exit_code: exitCode};\n }\n\n if (\n passed === false &&\n gateResult.uncheckable === true &&\n typeof reason === 'string' &&\n isIntOrNull(exitCode)\n ) {\n if (reason === GATE_EVALUATION_ERROR_REASON) {\n return {kind: 'evaluation_error', reason, exit_code: exitCode};\n }\n return {kind: 'uncheckable', passed, uncheckable: true, reason, exit_code: exitCode};\n }\n\n if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'failed', passed, source, exit_code: exitCode};\n }\n\n return {kind: 'unknown', data: gateResult};\n}\n\nexport function toStepDto(step: Step): StepDto {\n return {\n id: step.id,\n job_execution_id: step.jobExecutionId,\n key: step.key,\n name: step.name,\n source_location: toStepSourceLocationDto(step.sourceLocation),\n status: step.status,\n type: step.type,\n config: step.config,\n error: toStepErrorDto(step.error, step.type === 'setup' ? 'setup' : 'user'),\n position: step.position,\n current_attempt: step.currentAttempt,\n created_at: step.createdAt.toISOString(),\n updated_at: step.updatedAt.toISOString(),\n };\n}\n\nfunction toStepSourceLocationDto(\n sourceLocation: Step['sourceLocation'],\n): StepDto['source_location'] {\n if (sourceLocation === null) return null;\n return {\n start_line: sourceLocation.startLine,\n end_line: sourceLocation.endLine,\n };\n}\n\nexport function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto {\n return {\n id: attempt.id,\n step_id: attempt.stepId,\n attempt: attempt.attempt,\n execution_order: attempt.executionOrder,\n status: attempt.status,\n exit_code: attempt.exitCode,\n output: attempt.output,\n outputs: attempt.output,\n response: attempt.response,\n error: attempt.error,\n gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),\n restart_feedback: attempt.restartFeedback,\n started_at: attempt.startedAt.toISOString(),\n finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null,\n };\n}\n"],"names":["agentConfigIssueSchema","stepErrorReasonSchema","GATE_EVALUATION_ERROR_REASON","toStepErrorDto","error","category","message","exitCode","signal","undefined","field","source","reason","safeParse","agentConfigIssue","exit_code","success","data","agent_config_issue","fromStepErrorDto","isIntOrNull","value","Number","isInteger","toStepGateResultDto","gateResult","status","kind","passed","uncheckable","toStepDto","step","id","job_execution_id","jobExecutionId","key","name","source_location","toStepSourceLocationDto","sourceLocation","type","config","position","current_attempt","currentAttempt","created_at","createdAt","toISOString","updated_at","updatedAt","start_line","startLine","end_line","endLine","toStepAttemptDto","attempt","step_id","stepId","execution_order","executionOrder","output","outputs","response","gate_result","restart_feedback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H,QAAQI,cAAc;QACvCjC,QAAQ6B,QAAQ7B,MAAM;QACtBX,WAAWwC,QAAQhD,QAAQ;QAC3BqD,QAAQL,QAAQK,MAAM;QACtBC,SAASN,QAAQK,MAAM;QACvBE,UAAUP,QAAQO,QAAQ;QAC1B1D,OAAOmD,QAAQnD,KAAK;QACpB2D,aAAavC,oBAAoB+B,QAAQ9B,UAAU,EAAE8B,QAAQ7B,MAAM;QACnEsC,kBAAkBT,QAAQU,eAAe;QACzCC,YAAYX,QAAQY,SAAS,CAACpB,WAAW;QACzCqB,aAAab,QAAQc,UAAU,GAAGd,QAAQc,UAAU,CAACtB,WAAW,KAAK;IACvE;AACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WorkflowRunAttemptDto, WorkflowRunDto } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import type { WorkflowRun } from '#core/entities/workflow-run.js';
|
|
3
|
+
import type { WorkflowRunAttempt } from '#core/entities/workflow-run-attempt.js';
|
|
4
|
+
export declare function toRunDto(run: WorkflowRun, latestAttempt?: number): WorkflowRunDto;
|
|
5
|
+
export declare function toRunAttemptDto(attempt: WorkflowRunAttempt): WorkflowRunAttemptDto;
|
|
6
|
+
//# sourceMappingURL=workflow-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,wCAAwC,CAAC;AAE/E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,SAAqB,GAAG,cAAc,CAoB7F;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,qBAAqB,CAWlF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function toRunDto(run, latestAttempt = run.currentAttempt) {
|
|
2
|
+
return {
|
|
3
|
+
id: run.id,
|
|
4
|
+
project_id: run.projectId,
|
|
5
|
+
definition_id: run.definitionId,
|
|
6
|
+
name: run.name,
|
|
7
|
+
status: run.status,
|
|
8
|
+
current_attempt: run.currentAttempt,
|
|
9
|
+
latest_attempt: latestAttempt,
|
|
10
|
+
trigger_provider: run.triggerProvider,
|
|
11
|
+
trigger_source: run.triggerSource,
|
|
12
|
+
trigger_event: run.triggerEvent,
|
|
13
|
+
trigger_payload: run.triggerPayload,
|
|
14
|
+
inputs: run.inputs,
|
|
15
|
+
source_snapshot: run.sourceSnapshot,
|
|
16
|
+
created_at: run.createdAt.toISOString(),
|
|
17
|
+
updated_at: run.updatedAt.toISOString(),
|
|
18
|
+
started_at: run.startedAt?.toISOString() ?? null,
|
|
19
|
+
finished_at: run.finishedAt?.toISOString() ?? null
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function toRunAttemptDto(attempt) {
|
|
23
|
+
return {
|
|
24
|
+
id: attempt.id,
|
|
25
|
+
workflow_run_id: attempt.workflowRunId,
|
|
26
|
+
attempt: attempt.attempt,
|
|
27
|
+
status: attempt.status,
|
|
28
|
+
created_at: attempt.createdAt.toISOString(),
|
|
29
|
+
started_at: attempt.startedAt?.toISOString() ?? null,
|
|
30
|
+
finished_at: attempt.finishedAt?.toISOString() ?? null,
|
|
31
|
+
rerun_mode: attempt.rerunMode
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=workflow-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/workflow-run.ts"],"sourcesContent":["import type {WorkflowRunAttemptDto, WorkflowRunDto} from '@shipfox/api-workflows-dto';\nimport type {WorkflowRun} from '#core/entities/workflow-run.js';\nimport type {WorkflowRunAttempt} from '#core/entities/workflow-run-attempt.js';\n\nexport function toRunDto(run: WorkflowRun, latestAttempt = run.currentAttempt): WorkflowRunDto {\n return {\n id: run.id,\n project_id: run.projectId,\n definition_id: run.definitionId,\n name: run.name,\n status: run.status,\n current_attempt: run.currentAttempt,\n latest_attempt: latestAttempt,\n trigger_provider: run.triggerProvider,\n trigger_source: run.triggerSource,\n trigger_event: run.triggerEvent,\n trigger_payload: run.triggerPayload,\n inputs: run.inputs,\n source_snapshot: run.sourceSnapshot,\n created_at: run.createdAt.toISOString(),\n updated_at: run.updatedAt.toISOString(),\n started_at: run.startedAt?.toISOString() ?? null,\n finished_at: run.finishedAt?.toISOString() ?? null,\n };\n}\n\nexport function toRunAttemptDto(attempt: WorkflowRunAttempt): WorkflowRunAttemptDto {\n return {\n id: attempt.id,\n workflow_run_id: attempt.workflowRunId,\n attempt: attempt.attempt,\n status: attempt.status,\n created_at: attempt.createdAt.toISOString(),\n started_at: attempt.startedAt?.toISOString() ?? null,\n finished_at: attempt.finishedAt?.toISOString() ?? null,\n rerun_mode: attempt.rerunMode,\n };\n}\n"],"names":["toRunDto","run","latestAttempt","currentAttempt","id","project_id","projectId","definition_id","definitionId","name","status","current_attempt","latest_attempt","trigger_provider","triggerProvider","trigger_source","triggerSource","trigger_event","triggerEvent","trigger_payload","triggerPayload","inputs","source_snapshot","sourceSnapshot","created_at","createdAt","toISOString","updated_at","updatedAt","started_at","startedAt","finished_at","finishedAt","toRunAttemptDto","attempt","workflow_run_id","workflowRunId","rerun_mode","rerunMode"],"mappings":"AAIA,OAAO,SAASA,SAASC,GAAgB,EAAEC,gBAAgBD,IAAIE,cAAc;IAC3E,OAAO;QACLC,IAAIH,IAAIG,EAAE;QACVC,YAAYJ,IAAIK,SAAS;QACzBC,eAAeN,IAAIO,YAAY;QAC/BC,MAAMR,IAAIQ,IAAI;QACdC,QAAQT,IAAIS,MAAM;QAClBC,iBAAiBV,IAAIE,cAAc;QACnCS,gBAAgBV;QAChBW,kBAAkBZ,IAAIa,eAAe;QACrCC,gBAAgBd,IAAIe,aAAa;QACjCC,eAAehB,IAAIiB,YAAY;QAC/BC,iBAAiBlB,IAAImB,cAAc;QACnCC,QAAQpB,IAAIoB,MAAM;QAClBC,iBAAiBrB,IAAIsB,cAAc;QACnCC,YAAYvB,IAAIwB,SAAS,CAACC,WAAW;QACrCC,YAAY1B,IAAI2B,SAAS,CAACF,WAAW;QACrCG,YAAY5B,IAAI6B,SAAS,EAAEJ,iBAAiB;QAC5CK,aAAa9B,IAAI+B,UAAU,EAAEN,iBAAiB;IAChD;AACF;AAEA,OAAO,SAASO,gBAAgBC,OAA2B;IACzD,OAAO;QACL9B,IAAI8B,QAAQ9B,EAAE;QACd+B,iBAAiBD,QAAQE,aAAa;QACtCF,SAASA,QAAQA,OAAO;QACxBxB,QAAQwB,QAAQxB,MAAM;QACtBc,YAAYU,QAAQT,SAAS,CAACC,WAAW;QACzCG,YAAYK,QAAQJ,SAAS,EAAEJ,iBAAiB;QAChDK,aAAaG,QAAQF,UAAU,EAAEN,iBAAiB;QAClDW,YAAYH,QAAQI,SAAS;IAC/B;AACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { workflowRoutes as routes } from './routes/index.js';
|
|
2
|
+
export { onJobEventDelivered, onJobStepsSettled, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onWorkflowRunAttemptCreated, onWorkflowRunCancelled, } from './subscribers/index.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,IAAI,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { workflowRoutes as routes } from './routes/index.js';
|
|
2
|
+
export { onJobEventDelivered, onJobStepsSettled, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from './subscribers/index.js';
|
|
3
|
+
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/presentation/index.ts"],"sourcesContent":["export {workflowRoutes as routes} from './routes/index.js';\nexport {\n onJobEventDelivered,\n onJobStepsSettled,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from './subscribers/index.js';\n"],"names":["workflowRoutes","routes","onJobEventDelivered","onJobStepsSettled","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onWorkflowRunAttemptCreated","onWorkflowRunCancelled"],"mappings":"AAAA,SAAQA,kBAAkBC,MAAM,QAAO,oBAAoB;AAC3D,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime-config.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,uBAAuB,iDAkElC,CAAC"}
|