@shipfox/api-workflows 10.2.0 → 12.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 +8 -8
- package/CHANGELOG.md +117 -0
- package/README.md +75 -0
- package/dist/core/agent-defaults.d.ts +2 -1
- package/dist/core/agent-defaults.d.ts.map +1 -1
- package/dist/core/agent-defaults.js.map +1 -1
- package/dist/core/checkout.d.ts +7 -21
- package/dist/core/checkout.d.ts.map +1 -1
- package/dist/core/checkout.js +122 -41
- package/dist/core/checkout.js.map +1 -1
- package/dist/core/entities/job-execution.d.ts +8 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -1
- package/dist/core/entities/job-execution.js +13 -1
- package/dist/core/entities/job-execution.js.map +1 -1
- package/dist/core/entities/job-listener-event.d.ts +2 -0
- package/dist/core/entities/job-listener-event.d.ts.map +1 -1
- package/dist/core/entities/job-listener-event.js.map +1 -1
- package/dist/core/entities/step.d.ts +13 -3
- package/dist/core/entities/step.d.ts.map +1 -1
- package/dist/core/entities/step.js +6 -0
- package/dist/core/entities/step.js.map +1 -1
- package/dist/core/entities/workflow-run-attempt.d.ts +1 -0
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -1
- package/dist/core/entities/workflow-run-attempt.js.map +1 -1
- package/dist/core/entities/workflow-run.d.ts +17 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/core/errors.d.ts +9 -2
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +10 -5
- package/dist/core/errors.js.map +1 -1
- package/dist/core/job-execution.d.ts.map +1 -1
- package/dist/core/job-execution.js +14 -8
- package/dist/core/job-execution.js.map +1 -1
- package/dist/core/job-transition/decide-job-activation.d.ts +1 -0
- package/dist/core/job-transition/decide-job-activation.d.ts.map +1 -1
- package/dist/core/job-transition/decide-job-activation.js +1 -0
- package/dist/core/job-transition/decide-job-activation.js.map +1 -1
- package/dist/core/job-transition/derive-job-success.d.ts +1 -0
- package/dist/core/job-transition/derive-job-success.d.ts.map +1 -1
- package/dist/core/job-transition/derive-job-success.js +5 -8
- package/dist/core/job-transition/derive-job-success.js.map +1 -1
- package/dist/core/listener-execution-materialization.d.ts +6 -3
- package/dist/core/listener-execution-materialization.d.ts.map +1 -1
- package/dist/core/listener-execution-materialization.js +44 -6
- package/dist/core/listener-execution-materialization.js.map +1 -1
- package/dist/core/resolve-trigger-reference.d.ts +11 -0
- package/dist/core/resolve-trigger-reference.d.ts.map +1 -0
- package/dist/core/resolve-trigger-reference.js +39 -0
- package/dist/core/resolve-trigger-reference.js.map +1 -0
- package/dist/core/run-workflow.d.ts +1 -0
- package/dist/core/run-workflow.d.ts.map +1 -1
- package/dist/core/run-workflow.js +1 -0
- package/dist/core/run-workflow.js.map +1 -1
- package/dist/core/step-config/agent.d.ts +1 -2
- package/dist/core/step-config/agent.d.ts.map +1 -1
- package/dist/core/step-config/agent.js +22 -7
- package/dist/core/step-config/agent.js.map +1 -1
- package/dist/core/step-config/assemble-run-context.d.ts +19 -8
- package/dist/core/step-config/assemble-run-context.d.ts.map +1 -1
- package/dist/core/step-config/assemble-run-context.js +51 -19
- package/dist/core/step-config/assemble-run-context.js.map +1 -1
- package/dist/core/step-config/complete-step-dispatch-config.d.ts.map +1 -1
- package/dist/core/step-config/complete-step-dispatch-config.js +72 -4
- package/dist/core/step-config/complete-step-dispatch-config.js.map +1 -1
- package/dist/core/step-config/index.d.ts +1 -0
- package/dist/core/step-config/index.d.ts.map +1 -1
- package/dist/core/step-config/index.js +1 -0
- package/dist/core/step-config/index.js.map +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.d.ts +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.d.ts.map +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.js +49 -8
- package/dist/core/step-config/materialize-job-execution-steps.js.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.d.ts +3 -3
- package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.js +9 -5
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
- package/dist/core/step-config/resolve-job-execution-name.d.ts +3 -3
- package/dist/core/step-config/resolve-job-execution-name.d.ts.map +1 -1
- package/dist/core/step-config/resolve-job-execution-name.js +24 -13
- package/dist/core/step-config/resolve-job-execution-name.js.map +1 -1
- package/dist/core/step-config/resolve-step-config.d.ts.map +1 -1
- package/dist/core/step-config/resolve-step-config.js +174 -9
- package/dist/core/step-config/resolve-step-config.js.map +1 -1
- package/dist/core/step-config/resolve-workflow-run-name.d.ts +19 -0
- package/dist/core/step-config/resolve-workflow-run-name.d.ts.map +1 -0
- package/dist/core/step-config/resolve-workflow-run-name.js +73 -0
- package/dist/core/step-config/resolve-workflow-run-name.js.map +1 -0
- package/dist/core/step-transition/decide-step-transition.js.map +1 -1
- package/dist/core/step-transition/evaluate-gate.d.ts +2 -1
- package/dist/core/step-transition/evaluate-gate.d.ts.map +1 -1
- package/dist/core/step-transition/evaluate-gate.js +5 -3
- package/dist/core/step-transition/evaluate-gate.js.map +1 -1
- package/dist/core/workflow-run-creation.d.ts +3 -0
- package/dist/core/workflow-run-creation.d.ts.map +1 -1
- package/dist/core/workflow-run-creation.js +22 -7
- package/dist/core/workflow-run-creation.js.map +1 -1
- package/dist/db/db.d.ts +278 -10
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +2 -0
- package/dist/db/db.js.map +1 -1
- package/dist/db/index.d.ts +3 -2
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +2 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/job-listener-events.d.ts +2 -0
- package/dist/db/job-listener-events.d.ts.map +1 -1
- package/dist/db/job-listener-events.js +1 -0
- package/dist/db/job-listener-events.js.map +1 -1
- package/dist/db/job-listeners.d.ts +2 -0
- package/dist/db/job-listeners.d.ts.map +1 -1
- package/dist/db/job-listeners.js +81 -21
- package/dist/db/job-listeners.js.map +1 -1
- package/dist/db/schema/job-executions.d.ts +3 -3
- package/dist/db/schema/job-executions.d.ts.map +1 -1
- package/dist/db/schema/job-executions.js +8 -4
- package/dist/db/schema/job-executions.js.map +1 -1
- package/dist/db/schema/job-listener-events.d.ts +20 -0
- package/dist/db/schema/job-listener-events.d.ts.map +1 -1
- package/dist/db/schema/job-listener-events.js +2 -0
- package/dist/db/schema/job-listener-events.js.map +1 -1
- package/dist/db/schema/step-attempts.js +2 -2
- package/dist/db/schema/step-attempts.js.map +1 -1
- package/dist/db/schema/steps.d.ts +4 -2
- package/dist/db/schema/steps.d.ts.map +1 -1
- package/dist/db/schema/steps.js +1 -1
- package/dist/db/schema/steps.js.map +1 -1
- package/dist/db/schema/workflow-run-attempts.d.ts +21 -2
- package/dist/db/schema/workflow-run-attempts.d.ts.map +1 -1
- package/dist/db/schema/workflow-run-attempts.js +2 -0
- package/dist/db/schema/workflow-run-attempts.js.map +1 -1
- package/dist/db/schema/workflow-run-counters.d.ts +43 -0
- package/dist/db/schema/workflow-run-counters.d.ts.map +1 -0
- package/dist/db/schema/workflow-run-counters.js +10 -0
- package/dist/db/schema/workflow-run-counters.js.map +1 -0
- package/dist/db/schema/workflow-runs.d.ts +54 -1
- package/dist/db/schema/workflow-runs.d.ts.map +1 -1
- package/dist/db/schema/workflow-runs.js +10 -2
- package/dist/db/schema/workflow-runs.js.map +1 -1
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
- package/dist/db/workflow-runs/job-executions.js +35 -14
- package/dist/db/workflow-runs/job-executions.js.map +1 -1
- package/dist/db/workflow-runs/jobs.d.ts +2 -0
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +9 -5
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/db/workflow-runs/queries.d.ts +51 -0
- package/dist/db/workflow-runs/queries.d.ts.map +1 -1
- package/dist/db/workflow-runs/queries.js +82 -2
- package/dist/db/workflow-runs/queries.js.map +1 -1
- package/dist/db/workflow-runs/run-create.d.ts +1 -0
- package/dist/db/workflow-runs/run-create.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-create.js +159 -32
- package/dist/db/workflow-runs/run-create.js.map +1 -1
- package/dist/db/workflow-runs/run-rerun.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-rerun.js +13 -5
- package/dist/db/workflow-runs/run-rerun.js.map +1 -1
- package/dist/db/workflow-runs/shared.d.ts +1 -0
- package/dist/db/workflow-runs/shared.d.ts.map +1 -1
- package/dist/db/workflow-runs/shared.js +2 -1
- package/dist/db/workflow-runs/shared.js.map +1 -1
- package/dist/db/workflow-runs/steps.js +3 -3
- package/dist/db/workflow-runs/steps.js.map +1 -1
- package/dist/db/workflow-runs.d.ts +4 -3
- package/dist/db/workflow-runs.d.ts.map +1 -1
- package/dist/db/workflow-runs.js +3 -2
- package/dist/db/workflow-runs.js.map +1 -1
- package/dist/metrics/instance.d.ts +1 -0
- package/dist/metrics/instance.d.ts.map +1 -1
- package/dist/metrics/instance.js +9 -0
- package/dist/metrics/instance.js.map +1 -1
- package/dist/presentation/dto/checkout-token.d.ts +1 -0
- package/dist/presentation/dto/checkout-token.d.ts.map +1 -1
- package/dist/presentation/dto/checkout-token.js +1 -0
- package/dist/presentation/dto/checkout-token.js.map +1 -1
- package/dist/presentation/dto/index.d.ts +1 -1
- package/dist/presentation/dto/index.d.ts.map +1 -1
- package/dist/presentation/dto/index.js +1 -1
- package/dist/presentation/dto/index.js.map +1 -1
- package/dist/presentation/dto/step.d.ts.map +1 -1
- package/dist/presentation/dto/step.js +2 -2
- package/dist/presentation/dto/step.js.map +1 -1
- package/dist/presentation/dto/workflow-run.d.ts +3 -1
- package/dist/presentation/dto/workflow-run.d.ts.map +1 -1
- package/dist/presentation/dto/workflow-run.js +34 -0
- package/dist/presentation/dto/workflow-run.js.map +1 -1
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +31 -3
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/presentation/routes/checkout-token.d.ts +1 -1
- package/dist/presentation/routes/checkout-token.d.ts.map +1 -1
- package/dist/presentation/routes/checkout-token.js +32 -20
- package/dist/presentation/routes/checkout-token.js.map +1 -1
- package/dist/presentation/routes/leased-step.d.ts +2 -0
- package/dist/presentation/routes/leased-step.d.ts.map +1 -1
- package/dist/presentation/routes/leased-step.js +2 -1
- package/dist/presentation/routes/leased-step.js.map +1 -1
- package/dist/presentation/routes/list-runs.d.ts.map +1 -1
- package/dist/presentation/routes/list-runs.js +9 -3
- package/dist/presentation/routes/list-runs.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +1 -0
- package/dist/presentation/routes/project-access.d.ts.map +1 -1
- package/dist/presentation/routes/report-step.d.ts.map +1 -1
- package/dist/presentation/routes/report-step.js +9 -2
- package/dist/presentation/routes/report-step.js.map +1 -1
- package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -1
- package/dist/presentation/routes/require-accessible-run.js +1 -1
- package/dist/presentation/routes/require-accessible-run.js.map +1 -1
- package/dist/presentation/subscribers/on-job-steps-settled.js +1 -1
- package/dist/presentation/subscribers/on-job-steps-settled.js.map +1 -1
- package/dist/presentation/subscribers/on-runner-job-claimed.d.ts.map +1 -1
- package/dist/presentation/subscribers/on-runner-job-claimed.js +21 -0
- package/dist/presentation/subscribers/on-runner-job-claimed.js.map +1 -1
- package/dist/temporal/activities/index.d.ts.map +1 -1
- package/dist/temporal/activities/index.js +2 -1
- package/dist/temporal/activities/index.js.map +1 -1
- package/dist/temporal/activities/orchestration-activities.d.ts +1 -0
- package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
- package/dist/temporal/activities/orchestration-activities.js.map +1 -1
- package/dist/temporal/constants.d.ts +1 -0
- package/dist/temporal/constants.d.ts.map +1 -1
- package/dist/temporal/constants.js +1 -0
- package/dist/temporal/constants.js.map +1 -1
- package/dist/temporal/index.d.ts +1 -1
- package/dist/temporal/index.d.ts.map +1 -1
- package/dist/temporal/index.js +1 -1
- package/dist/temporal/index.js.map +1 -1
- package/dist/temporal/workflows/index.bundle.js +82 -43
- package/dist/temporal/workflows/index.d.ts +1 -1
- package/dist/temporal/workflows/index.d.ts.map +1 -1
- package/dist/temporal/workflows/index.js +1 -1
- package/dist/temporal/workflows/index.js.map +1 -1
- package/dist/temporal/workflows/job-execution-orchestration.d.ts +5 -0
- package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -1
- package/dist/temporal/workflows/job-execution-orchestration.js +77 -43
- package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -1
- package/dist/temporal/workflows/test-env.d.ts +5 -1
- package/dist/temporal/workflows/test-env.d.ts.map +1 -1
- package/dist/temporal/workflows/test-env.js +32 -11
- package/dist/temporal/workflows/test-env.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/drizzle/0000_initial.sql +14 -2
- package/drizzle/0001_windy_sunfire.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +93 -1
- package/drizzle/meta/0001_snapshot.json +1711 -0
- package/drizzle/meta/_journal.json +2 -2
- package/package.json +21 -21
- package/src/core/agent-defaults.ts +2 -1
- package/src/core/checkout.test.ts +378 -67
- package/src/core/checkout.ts +142 -59
- package/src/core/entities/job-execution.test.ts +21 -0
- package/src/core/entities/job-execution.ts +24 -0
- package/src/core/entities/job-listener-event.ts +3 -0
- package/src/core/entities/step.ts +15 -3
- package/src/core/entities/workflow-run-attempt.ts +1 -0
- package/src/core/entities/workflow-run.ts +16 -0
- package/src/core/errors.ts +21 -7
- package/src/core/job-execution.ts +27 -4
- package/src/core/job-transition/decide-job-activation.test.ts +4 -0
- package/src/core/job-transition/decide-job-activation.ts +2 -0
- package/src/core/job-transition/derive-job-success.test.ts +12 -0
- package/src/core/job-transition/derive-job-success.ts +6 -9
- package/src/core/listener-execution-materialization.test.ts +2 -0
- package/src/core/listener-execution-materialization.ts +57 -11
- package/src/core/resolve-trigger-reference.test.ts +160 -0
- package/src/core/resolve-trigger-reference.ts +53 -0
- package/src/core/run-workflow.ts +2 -0
- package/src/core/step-config/agent.ts +29 -12
- package/src/core/step-config/assemble-run-context.test.ts +149 -6
- package/src/core/step-config/assemble-run-context.ts +87 -25
- package/src/core/step-config/complete-step-dispatch-config.test.ts +125 -2
- package/src/core/step-config/complete-step-dispatch-config.ts +83 -1
- package/src/core/step-config/index.ts +7 -0
- package/src/core/step-config/materialize-job-execution-steps.test.ts +250 -1
- package/src/core/step-config/materialize-job-execution-steps.ts +57 -10
- package/src/core/step-config/materialize-workflow-model.test.ts +212 -4
- package/src/core/step-config/materialize-workflow-model.ts +33 -28
- package/src/core/step-config/resolve-job-execution-name.test.ts +37 -15
- package/src/core/step-config/resolve-job-execution-name.ts +30 -15
- package/src/core/step-config/resolve-step-config.ts +175 -10
- package/src/core/step-config/resolve-workflow-run-name.test.ts +115 -0
- package/src/core/step-config/resolve-workflow-run-name.ts +108 -0
- package/src/core/step-transition/decide-step-transition.ts +2 -2
- package/src/core/step-transition/evaluate-gate.test.ts +8 -0
- package/src/core/step-transition/evaluate-gate.ts +8 -1
- package/src/core/workflow-run-creation.test.ts +7 -4
- package/src/core/workflow-run-creation.ts +13 -7
- package/src/db/db.ts +2 -0
- package/src/db/index.ts +6 -0
- package/src/db/job-listener-events.test.ts +19 -0
- package/src/db/job-listener-events.ts +3 -0
- package/src/db/job-listeners.test.ts +187 -5
- package/src/db/job-listeners.ts +122 -30
- package/src/db/schema/job-executions.ts +12 -5
- package/src/db/schema/job-listener-events.ts +3 -0
- package/src/db/schema/step-attempts.ts +2 -2
- package/src/db/schema/steps.ts +2 -1
- package/src/db/schema/workflow-run-attempts.ts +2 -0
- package/src/db/schema/workflow-run-counters.ts +13 -0
- package/src/db/schema/workflow-runs.ts +11 -2
- package/src/db/workflow-runs/job-executions.ts +37 -15
- package/src/db/workflow-runs/jobs.ts +17 -4
- package/src/db/workflow-runs/queries.test.ts +206 -0
- package/src/db/workflow-runs/queries.ts +146 -2
- package/src/db/workflow-runs/run-create.test.ts +606 -8
- package/src/db/workflow-runs/run-create.ts +185 -40
- package/src/db/workflow-runs/run-rerun.test.ts +61 -2
- package/src/db/workflow-runs/run-rerun.ts +15 -5
- package/src/db/workflow-runs/shared.ts +2 -0
- package/src/db/workflow-runs/steps.ts +3 -3
- package/src/db/workflow-runs.ts +7 -0
- package/src/metrics/instance.ts +14 -0
- package/src/presentation/dto/checkout-token.test.ts +19 -9
- package/src/presentation/dto/checkout-token.ts +2 -1
- package/src/presentation/dto/index.ts +1 -1
- package/src/presentation/dto/job.test.ts +9 -0
- package/src/presentation/dto/step.test.ts +12 -0
- package/src/presentation/dto/step.ts +5 -2
- package/src/presentation/dto/workflow-run.ts +44 -2
- package/src/presentation/inter-module.test.ts +165 -0
- package/src/presentation/inter-module.ts +38 -4
- package/src/presentation/routes/cancel-run.test.ts +1 -1
- package/src/presentation/routes/checkout-token.test.ts +357 -142
- package/src/presentation/routes/checkout-token.ts +56 -26
- package/src/presentation/routes/get-run-aggregates.test.ts +1 -1
- package/src/presentation/routes/get-run.test.ts +29 -1
- package/src/presentation/routes/get-step-secrets.test.ts +7 -2
- package/src/presentation/routes/leased-step.ts +9 -1
- package/src/presentation/routes/list-run-attempts.test.ts +1 -1
- package/src/presentation/routes/list-runs.test.ts +58 -1
- package/src/presentation/routes/list-runs.ts +8 -3
- package/src/presentation/routes/report-step.test.ts +25 -0
- package/src/presentation/routes/report-step.ts +10 -2
- package/src/presentation/routes/require-accessible-run.ts +4 -1
- package/src/presentation/routes/rerun-run.test.ts +1 -1
- package/src/presentation/subscribers/on-job-steps-settled.ts +1 -1
- package/src/presentation/subscribers/on-runner-job-claimed.test.ts +49 -0
- package/src/presentation/subscribers/on-runner-job-claimed.ts +22 -0
- package/src/temporal/activities/index.ts +1 -0
- package/src/temporal/activities/orchestration-activities.ts +1 -0
- package/src/temporal/constants.ts +1 -0
- package/src/temporal/index.ts +1 -0
- package/src/temporal/workflows/index.ts +1 -0
- package/src/temporal/workflows/job-execution-orchestration.test.ts +142 -6
- package/src/temporal/workflows/job-execution-orchestration.ts +99 -50
- package/src/temporal/workflows/run-orchestration.test.ts +1 -1
- package/src/temporal/workflows/test-env.ts +50 -13
- package/test/factories/project.ts +2 -0
- package/test/factories/workflow-model.ts +80 -26
- package/test/factories/workflow-run.ts +4 -1
- package/test/fixtures/agent-inter-module.ts +2 -1
- package/test/fixtures/job-with-steps.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/drizzle/0001_agent_tool_materialization.sql +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/db/workflow-runs.ts"],"sourcesContent":["export type {\n UpdateJobExecutionStatusAtVersionParams,\n UpdateJobExecutionStatusParams,\n} from './workflow-runs/job-executions.js';\nexport {\n failJobExecutionAsTimedOut,\n getFirstJobExecutionByJobId,\n getJobExecutionById,\n getJobExecutionsByJobId,\n getJobExecutionsByWorkflowRunAttemptId,\n getLatestJobExecutionByJobId,\n recordJobExecutionQueuedAt,\n recordJobExecutionStartedAt,\n resolveJobExecutionAfterLeaseExpiry,\n updateJobExecutionStatus,\n} from './workflow-runs/job-executions.js';\nexport type {\n EvaluateJobActivationsParams,\n EvaluateJobSuccessResult,\n JobActivationDecision,\n JobScope,\n UpdateJobStatusAtVersionParams,\n UpdateJobStatusParams,\n} from './workflow-runs/jobs.js';\nexport {\n evaluateJobActivations,\n evaluateJobSuccess,\n getDirectDependencyJobContexts,\n getJobById,\n getJobScope,\n getJobsByWorkflowRunAttemptId,\n getJobsByWorkflowRunId,\n resolveJobStatusFromJobExecutions,\n updateJobStatus,\n updateJobStatusAtVersion,\n} from './workflow-runs/jobs.js';\nexport {\n writeJobStepsSettledOutbox,\n writeStepAttemptTerminatedOutbox,\n writeStepRestartEnqueuedOutbox,\n} from './workflow-runs/outbox.js';\nexport type {\n ListWorkflowRunsParams,\n ListWorkflowRunsResult,\n WorkflowJobExecutionDepth,\n WorkflowJobExecutionDepthParams,\n WorkflowRunAggregates,\n WorkflowRunCursor,\n WorkflowRunFilters,\n} from './workflow-runs/queries.js';\nexport {\n buildWorkflowRunListConditions,\n getJobExecutionDetail,\n getLatestAttempt,\n getWorkflowJobExecutionDepth,\n getWorkflowRunAggregates,\n getWorkflowRunAttemptById,\n getWorkflowRunByAttemptId,\n getWorkflowRunById,\n getWorkflowRunDetail,\n listRunAttempts,\n listWorkflowRuns,\n listWorkflowRunsByProject,\n} from './workflow-runs/queries.js';\nexport type {\n CancelWorkflowRunParams,\n CreateRerunWorkflowRunParams,\n CreateWorkflowRunParams,\n FailWorkflowRunAsTimedOutParams,\n UpdateWorkflowRunStatusParams,\n} from './workflow-runs/runs.js';\nexport {\n cancelWorkflowRun,\n createRerunWorkflowRun,\n createWorkflowRun,\n failWorkflowRunAsTimedOut,\n updateWorkflowRunStatus,\n} from './workflow-runs/runs.js';\nexport type {\n ApplyStepResultParams,\n BulkUpdateStepStatusesParams,\n CancelRemainingStepsParams,\n DispatchStepWithCompletedConfigParams,\n FinishStepAttemptParams,\n InsertRunningStepAttemptParams,\n MarkStepRunningParams,\n MarkStepSkippedParams,\n RewindStepsToPendingParams,\n} from './workflow-runs/steps.js';\nexport {\n applyStepResult,\n bulkUpdateStepStatuses,\n cancelRemainingSteps,\n countStepAttempts,\n dispatchStepWithCompletedConfig,\n finishStepAttempt,\n getStepAttempts,\n getStepAttemptsByJobExecutionId,\n getStepAttemptsByJobIds,\n getStepById,\n getStepByIdForJobExecution,\n getStepsByJobExecutionId,\n getStepsByJobExecutionIdForUpdate,\n getStepsByJobId,\n insertRunningStepAttempt,\n markStepRunning,\n markStepSkipped,\n rewindStepsToPending,\n settleJobFailed,\n} from './workflow-runs/steps.js';\n"],"names":["failJobExecutionAsTimedOut","getFirstJobExecutionByJobId","getJobExecutionById","getJobExecutionsByJobId","getJobExecutionsByWorkflowRunAttemptId","getLatestJobExecutionByJobId","recordJobExecutionQueuedAt","recordJobExecutionStartedAt","resolveJobExecutionAfterLeaseExpiry","updateJobExecutionStatus","evaluateJobActivations","evaluateJobSuccess","getDirectDependencyJobContexts","getJobById","getJobScope","getJobsByWorkflowRunAttemptId","getJobsByWorkflowRunId","resolveJobStatusFromJobExecutions","updateJobStatus","updateJobStatusAtVersion","writeJobStepsSettledOutbox","writeStepAttemptTerminatedOutbox","writeStepRestartEnqueuedOutbox","buildWorkflowRunListConditions","getJobExecutionDetail","getLatestAttempt","getWorkflowJobExecutionDepth","getWorkflowRunAggregates","getWorkflowRunAttemptById","getWorkflowRunByAttemptId","getWorkflowRunById","getWorkflowRunDetail","listRunAttempts","listWorkflowRuns","listWorkflowRunsByProject","cancelWorkflowRun","createRerunWorkflowRun","createWorkflowRun","failWorkflowRunAsTimedOut","updateWorkflowRunStatus","applyStepResult","bulkUpdateStepStatuses","cancelRemainingSteps","countStepAttempts","dispatchStepWithCompletedConfig","finishStepAttempt","getStepAttempts","getStepAttemptsByJobExecutionId","getStepAttemptsByJobIds","getStepById","getStepByIdForJobExecution","getStepsByJobExecutionId","getStepsByJobExecutionIdForUpdate","getStepsByJobId","insertRunningStepAttempt","markStepRunning","markStepSkipped","rewindStepsToPending","settleJobFailed"],"mappings":"AAIA,SACEA,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,uBAAuB,EACvBC,sCAAsC,EACtCC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mCAAmC,EACnCC,wBAAwB,QACnB,oCAAoC;AAS3C,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,UAAU,EACVC,WAAW,EACXC,6BAA6B,EAC7BC,sBAAsB,EACtBC,iCAAiC,EACjCC,eAAe,EACfC,wBAAwB,QACnB,0BAA0B;AACjC,SACEC,0BAA0B,EAC1BC,gCAAgC,EAChCC,8BAA8B,QACzB,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../../src/db/workflow-runs.ts"],"sourcesContent":["export type {\n UpdateJobExecutionStatusAtVersionParams,\n UpdateJobExecutionStatusParams,\n} from './workflow-runs/job-executions.js';\nexport {\n failJobExecutionAsTimedOut,\n getFirstJobExecutionByJobId,\n getJobExecutionById,\n getJobExecutionsByJobId,\n getJobExecutionsByWorkflowRunAttemptId,\n getLatestJobExecutionByJobId,\n recordJobExecutionQueuedAt,\n recordJobExecutionStartedAt,\n resolveJobExecutionAfterLeaseExpiry,\n updateJobExecutionStatus,\n} from './workflow-runs/job-executions.js';\nexport type {\n EvaluateJobActivationsParams,\n EvaluateJobSuccessResult,\n JobActivationDecision,\n JobScope,\n UpdateJobStatusAtVersionParams,\n UpdateJobStatusParams,\n} from './workflow-runs/jobs.js';\nexport {\n evaluateJobActivations,\n evaluateJobSuccess,\n getDirectDependencyJobContexts,\n getJobById,\n getJobScope,\n getJobsByWorkflowRunAttemptId,\n getJobsByWorkflowRunId,\n resolveJobStatusFromJobExecutions,\n updateJobStatus,\n updateJobStatusAtVersion,\n} from './workflow-runs/jobs.js';\nexport {\n writeJobStepsSettledOutbox,\n writeStepAttemptTerminatedOutbox,\n writeStepRestartEnqueuedOutbox,\n} from './workflow-runs/outbox.js';\nexport type {\n ListWorkflowRunsParams,\n ListWorkflowRunsResult,\n WorkflowJobExecutionDepth,\n WorkflowJobExecutionDepthParams,\n WorkflowRunAggregates,\n WorkflowRunCursor,\n WorkflowRunFilters,\n WorkflowRunJobStatusCount,\n WorkflowRunJobSummary,\n WorkflowRunJobSummaryTarget,\n WorkflowRunJobsSummary,\n} from './workflow-runs/queries.js';\nexport {\n buildWorkflowRunListConditions,\n getJobExecutionDetail,\n getLatestAttempt,\n getWorkflowJobExecutionDepth,\n getWorkflowRunAggregates,\n getWorkflowRunAttemptById,\n getWorkflowRunByAttemptId,\n getWorkflowRunById,\n getWorkflowRunDetail,\n listRunAttempts,\n listWorkflowRunJobSummaries,\n listWorkflowRuns,\n listWorkflowRunsByProject,\n} from './workflow-runs/queries.js';\nexport type {\n CancelWorkflowRunParams,\n CreateRerunWorkflowRunParams,\n CreateWorkflowRunParams,\n FailWorkflowRunAsTimedOutParams,\n UpdateWorkflowRunStatusParams,\n} from './workflow-runs/runs.js';\nexport {\n cancelWorkflowRun,\n createRerunWorkflowRun,\n createWorkflowRun,\n failWorkflowRunAsTimedOut,\n loadReferencedVariables,\n updateWorkflowRunStatus,\n} from './workflow-runs/runs.js';\nexport {getWorkflowContextForJob} from './workflow-runs/shared.js';\nexport type {\n ApplyStepResultParams,\n BulkUpdateStepStatusesParams,\n CancelRemainingStepsParams,\n DispatchStepWithCompletedConfigParams,\n FinishStepAttemptParams,\n InsertRunningStepAttemptParams,\n MarkStepRunningParams,\n MarkStepSkippedParams,\n RewindStepsToPendingParams,\n} from './workflow-runs/steps.js';\nexport {\n applyStepResult,\n bulkUpdateStepStatuses,\n cancelRemainingSteps,\n countStepAttempts,\n dispatchStepWithCompletedConfig,\n finishStepAttempt,\n getStepAttempts,\n getStepAttemptsByJobExecutionId,\n getStepAttemptsByJobIds,\n getStepById,\n getStepByIdForJobExecution,\n getStepsByJobExecutionId,\n getStepsByJobExecutionIdForUpdate,\n getStepsByJobId,\n insertRunningStepAttempt,\n markStepRunning,\n markStepSkipped,\n rewindStepsToPending,\n settleJobFailed,\n} from './workflow-runs/steps.js';\n"],"names":["failJobExecutionAsTimedOut","getFirstJobExecutionByJobId","getJobExecutionById","getJobExecutionsByJobId","getJobExecutionsByWorkflowRunAttemptId","getLatestJobExecutionByJobId","recordJobExecutionQueuedAt","recordJobExecutionStartedAt","resolveJobExecutionAfterLeaseExpiry","updateJobExecutionStatus","evaluateJobActivations","evaluateJobSuccess","getDirectDependencyJobContexts","getJobById","getJobScope","getJobsByWorkflowRunAttemptId","getJobsByWorkflowRunId","resolveJobStatusFromJobExecutions","updateJobStatus","updateJobStatusAtVersion","writeJobStepsSettledOutbox","writeStepAttemptTerminatedOutbox","writeStepRestartEnqueuedOutbox","buildWorkflowRunListConditions","getJobExecutionDetail","getLatestAttempt","getWorkflowJobExecutionDepth","getWorkflowRunAggregates","getWorkflowRunAttemptById","getWorkflowRunByAttemptId","getWorkflowRunById","getWorkflowRunDetail","listRunAttempts","listWorkflowRunJobSummaries","listWorkflowRuns","listWorkflowRunsByProject","cancelWorkflowRun","createRerunWorkflowRun","createWorkflowRun","failWorkflowRunAsTimedOut","loadReferencedVariables","updateWorkflowRunStatus","getWorkflowContextForJob","applyStepResult","bulkUpdateStepStatuses","cancelRemainingSteps","countStepAttempts","dispatchStepWithCompletedConfig","finishStepAttempt","getStepAttempts","getStepAttemptsByJobExecutionId","getStepAttemptsByJobIds","getStepById","getStepByIdForJobExecution","getStepsByJobExecutionId","getStepsByJobExecutionIdForUpdate","getStepsByJobId","insertRunningStepAttempt","markStepRunning","markStepSkipped","rewindStepsToPending","settleJobFailed"],"mappings":"AAIA,SACEA,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,uBAAuB,EACvBC,sCAAsC,EACtCC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mCAAmC,EACnCC,wBAAwB,QACnB,oCAAoC;AAS3C,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,UAAU,EACVC,WAAW,EACXC,6BAA6B,EAC7BC,sBAAsB,EACtBC,iCAAiC,EACjCC,eAAe,EACfC,wBAAwB,QACnB,0BAA0B;AACjC,SACEC,0BAA0B,EAC1BC,gCAAgC,EAChCC,8BAA8B,QACzB,4BAA4B;AAcnC,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,gBAAgB,EAChBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,yBAAyB,EACzBC,yBAAyB,EACzBC,kBAAkB,EAClBC,oBAAoB,EACpBC,eAAe,EACfC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,QACpB,6BAA6B;AAQpC,SACEC,iBAAiB,EACjBC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,uBAAuB,EACvBC,uBAAuB,QAClB,0BAA0B;AACjC,SAAQC,wBAAwB,QAAO,4BAA4B;AAYnE,SACEC,eAAe,EACfC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,+BAA+B,EAC/BC,iBAAiB,EACjBC,eAAe,EACfC,+BAA+B,EAC/BC,uBAAuB,EACvBC,WAAW,EACXC,0BAA0B,EAC1BC,wBAAwB,EACxBC,iCAAiC,EACjCC,eAAe,EACfC,wBAAwB,EACxBC,eAAe,EACfC,eAAe,EACfC,oBAAoB,EACpBC,eAAe,QACV,2BAA2B"}
|
|
@@ -3,6 +3,7 @@ import type { JobExecutionStatus } from '#core/entities/job-execution.js';
|
|
|
3
3
|
import type { WorkflowRunStatus } from '#core/entities/workflow-run.js';
|
|
4
4
|
import type { RuntimeCompletionStatus } from '#core/workflow-scheduling/runtime-dag.js';
|
|
5
5
|
export declare function recordWorkflowRunCreated(provider: string): void;
|
|
6
|
+
export declare function recordWorkflowDisplayNameResolutionDegraded(field: 'workflow.run_name' | 'job.execution_name', cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization'): void;
|
|
6
7
|
export declare function recordWorkflowRunStatusChanged(status: WorkflowRunStatus): void;
|
|
7
8
|
export declare function recordWorkflowJobStatusChanged(status: JobStatus): void;
|
|
8
9
|
export declare function recordWorkflowJobExecutionStatusChanged(status: JobExecutionStatus): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/metrics/instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/metrics/instance.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,CAE7E;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAEhG"}
|
package/dist/metrics/instance.js
CHANGED
|
@@ -3,6 +3,9 @@ const meter = instanceMetrics.getMeter('workflows');
|
|
|
3
3
|
const runCreatedCount = meter.createCounter('workflows_run_created', {
|
|
4
4
|
description: 'Workflow runs created by bounded trigger provider'
|
|
5
5
|
});
|
|
6
|
+
const displayNameResolutionDegradedCount = meter.createCounter('workflows_display_name_resolution_degraded', {
|
|
7
|
+
description: 'Display-name resolution degradations by field and bounded cause'
|
|
8
|
+
});
|
|
6
9
|
const runStatusChangedCount = meter.createCounter('workflows_run_status_changed', {
|
|
7
10
|
description: 'Workflow run status transitions by resulting status'
|
|
8
11
|
});
|
|
@@ -63,6 +66,12 @@ export function recordWorkflowRunCreated(provider) {
|
|
|
63
66
|
provider
|
|
64
67
|
});
|
|
65
68
|
}
|
|
69
|
+
export function recordWorkflowDisplayNameResolutionDegraded(field, cause) {
|
|
70
|
+
displayNameResolutionDegradedCount.add(1, {
|
|
71
|
+
field,
|
|
72
|
+
cause
|
|
73
|
+
});
|
|
74
|
+
}
|
|
66
75
|
export function recordWorkflowRunStatusChanged(status) {
|
|
67
76
|
runStatusChangedCount.add(1, {
|
|
68
77
|
status
|
|
@@ -1 +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,
|
|
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 displayNameResolutionDegradedCount = meter.createCounter<{\n field: 'workflow.run_name' | 'job.execution_name';\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization';\n}>('workflows_display_name_resolution_degraded', {\n description: 'Display-name resolution degradations by field and bounded cause',\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 recordWorkflowDisplayNameResolutionDegraded(\n field: 'workflow.run_name' | 'job.execution_name',\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization',\n): void {\n displayNameResolutionDegradedCount.add(1, {field, cause});\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","displayNameResolutionDegradedCount","runStatusChangedCount","jobStatusChangedCount","jobExecutionStatusChangedCount","jobExecutionQueuedCount","jobExecutionStartedCount","jobExecutionStepsSettledCount","jobExecutionTimedOutCount","jobExecutionLeaseExpiryResolvedCount","stepRestartEnqueuedCount","listenerEventsReceivedCount","listenerExecutionsCount","listenerResolvedCount","agentToolWarningFailedCount","listenerEventsCoalesced","createHistogram","unit","advice","explicitBucketBoundaries","recordWorkflowRunCreated","provider","add","recordWorkflowDisplayNameResolutionDegraded","field","cause","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,qCAAqCL,MAAMG,aAAa,CAG3D,8CAA8C;IAC/CC,aAAa;AACf;AAEA,MAAME,wBAAwBN,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMG,wBAAwBP,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMI,iCAAiCR,MAAMG,aAAa,CACxD,0CACA;IAACC,aAAa;AAA+D;AAG/E,MAAMK,0BAA0BT,MAAMG,aAAa,CACjD,kCACA;IACEC,aAAa;AACf;AAGF,MAAMM,2BAA2BV,MAAMG,aAAa,CAClD,mCACA;IACEC,aAAa;AACf;AAGF,MAAMO,gCAAgCX,MAAMG,aAAa,CAEtD,yCAAyC;IAC1CC,aAAa;AACf;AAEA,MAAMQ,4BAA4BZ,MAAMG,aAAa,CACnD,qCACA;IACEC,aAAa;AACf;AAGF,MAAMS,uCAAuCb,MAAMG,aAAa,CAC9D,iDACA;IAACC,aAAa;AAA6D;AAG7E,MAAMU,2BAA2Bd,MAAMG,aAAa,CAClD,mCACA;IAACC,aAAa;AAAuE;AAGvF,MAAMW,8BAA8Bf,MAAMG,aAAa,CACrD,sCACA;IAACC,aAAa;AAAkE;AAGlF,MAAMY,0BAA0BhB,MAAMG,aAAa,CAEhD,iCAAiC;IAClCC,aAAa;AACf;AAEA,MAAMa,wBAAwBjB,MAAMG,aAAa,CAC/C,+BACA;IAACC,aA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AASgB,gCACdC,OAA6C;IAE7C1B,wBAAwBU,GAAG,CAAC,GAAG;QAACgB;IAAO;AACzC;AAEA,OAAO,SAASC,+BAA+BC,MAAwB;IACrE3B,sBAAsBS,GAAG,CAAC,GAAG;QAACkB;IAAM;AACtC;AAEA,OAAO,SAASC,8BAA8BC,SAAiB;IAC7D3B,wBAAwB4B,MAAM,CAACD;AACjC;AAEA,OAAO,SAASE,qCAAqCJ,MAAqC;IACxF1B,4BAA4BQ,GAAG,CAAC,GAAG;QAACkB;IAAM;AAC5C"}
|
|
@@ -13,6 +13,7 @@ type CheckoutSpec = {
|
|
|
13
13
|
};
|
|
14
14
|
import type { CheckoutTokenResponseDto } from '@shipfox/api-workflows-dto';
|
|
15
15
|
export declare function toCheckoutTokenDto(spec: CheckoutSpec, options: {
|
|
16
|
+
fetchDepth: number;
|
|
16
17
|
persist: boolean;
|
|
17
18
|
}): CheckoutTokenResponseDto;
|
|
18
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-token.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/checkout-token.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,IAAI,CAAA;KAAC,GAAG,SAAS,CAAC;IAC7E,SAAS,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAwCzE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,
|
|
1
|
+
{"version":3,"file":"checkout-token.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/checkout-token.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,IAAI,CAAA;KAAC,GAAG,SAAS,CAAC;IAC7E,SAAS,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAwCzE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,GAC9C,wBAAwB,CA2B1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/dto/checkout-token.ts"],"sourcesContent":["type CheckoutSpec = {\n repositoryUrl: string;\n ref: string;\n credentials?: {username: string; token: string; expiresAt: Date} | undefined;\n gitAuthor?: {name: string; email: string} | undefined;\n};\n\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":"AASA,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,
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/checkout-token.ts"],"sourcesContent":["type CheckoutSpec = {\n repositoryUrl: string;\n ref: string;\n credentials?: {username: string; token: string; expiresAt: Date} | undefined;\n gitAuthor?: {name: string; email: string} | undefined;\n};\n\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: {fetchDepth: number; 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 fetch_depth: options.fetchDepth,\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","fetch_depth","fetchDepth","gitAuthor","git_author","name","email","credentials","auth","kind","token","expires_at","expiresAt","toISOString","carry","host","checkoutHost","persist","scpLike","exec"],"mappings":"AASA,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,OAA+C;IAE/Cf,4BAA4Bc,KAAKb,aAAa;IAE9C,mEAAmE;IACnE,6EAA6E;IAC7E,oCAAoC;IACpC,OAAO;QACLe,gBAAgBF,KAAKb,aAAa;QAClCgB,KAAKH,KAAKG,GAAG;QACbC,aAAaH,QAAQI,UAAU;QAC/B,GAAIL,KAAKM,SAAS,GACd;YAACC,YAAY;gBAACC,MAAMR,KAAKM,SAAS,CAACE,IAAI;gBAAEC,OAAOT,KAAKM,SAAS,CAACG,KAAK;YAAA;QAAC,IACrE,CAAC,CAAC;QACN,GAAIT,KAAKU,WAAW,GAChB;YACEC,MAAM;gBACJC,MAAM;gBACNrB,UAAUS,KAAKU,WAAW,CAACnB,QAAQ;gBACnCsB,OAAOb,KAAKU,WAAW,CAACG,KAAK;gBAC7BC,YAAYd,KAAKU,WAAW,CAACK,SAAS,CAACC,WAAW;gBAClDC,OAAO;gBACPC,MAAMC,aAAanB,KAAKb,aAAa;gBACrCiC,SAASnB,QAAQmB,OAAO;YAC1B;QACF,IACA,CAAC,CAAC;IACR;AACF;AAEA,SAASD,aAAahC,aAAqB;IACzC,IAAI;QACF,MAAM+B,OAAO,IAAI5B,IAAIH,eAAe+B,IAAI;QACxC,IAAIA,MAAM,OAAOA;IACnB,EAAE,OAAM;IACN,oCAAoC;IACtC;IAEA,MAAMG,UAAUpC,iBAAiBqC,IAAI,CAACnC;IACtC,IAAIkC,SAAS,CAAC,EAAE,EAAE,OAAOA,OAAO,CAAC,EAAE;IAEnC,MAAM,IAAI5B,MAAM;AAClB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { toJobDto, toJobExecutionDto } from './job.js';
|
|
2
2
|
export { toStepAttemptDto, toStepDto } from './step.js';
|
|
3
|
-
export { toRunAttemptDto, toRunDto } from './workflow-run.js';
|
|
3
|
+
export { toRunAttemptDto, toRunDto, toRunListItemDto } from './workflow-run.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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"}
|
|
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,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { toJobDto, toJobExecutionDto } from './job.js';
|
|
2
2
|
export { toStepAttemptDto, toStepDto } from './step.js';
|
|
3
|
-
export { toRunAttemptDto, toRunDto } from './workflow-run.js';
|
|
3
|
+
export { toRunAttemptDto, toRunDto, toRunListItemDto } from './workflow-run.js';
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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"}
|
|
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, toRunListItemDto} from './workflow-run.js';\n"],"names":["toJobDto","toJobExecutionDto","toStepAttemptDto","toStepDto","toRunAttemptDto","toRunDto","toRunListItemDto"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,iBAAiB,QAAO,WAAW;AACrD,SAAQC,gBAAgB,EAAEC,SAAS,QAAO,YAAY;AACtD,SAAQC,eAAe,EAAEC,QAAQ,EAAEC,gBAAgB,QAAO,oBAAoB"}
|
|
@@ -1 +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,
|
|
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,CAmB7C;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiBrE"}
|
|
@@ -38,7 +38,7 @@ function toStepErrorDto(error, category) {
|
|
|
38
38
|
}
|
|
39
39
|
// Inverse of toStepErrorDto: reported wire errors land on the domain row in
|
|
40
40
|
// camelCase so the read path renders them back without a special case. `category`
|
|
41
|
-
// is intentionally NOT persisted
|
|
41
|
+
// is intentionally NOT persisted: the server derives it from the step type on
|
|
42
42
|
// read, so a runner-supplied category is ignored here.
|
|
43
43
|
export function fromStepErrorDto(error) {
|
|
44
44
|
if (!error) return null;
|
|
@@ -126,7 +126,7 @@ export function toStepDto(step) {
|
|
|
126
126
|
status: step.status,
|
|
127
127
|
type: step.type,
|
|
128
128
|
config: step.config,
|
|
129
|
-
error: toStepErrorDto(step.error, step.type === 'setup' ? 'setup' : 'user'),
|
|
129
|
+
error: toStepErrorDto(step.error, step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user'),
|
|
130
130
|
position: step.position,
|
|
131
131
|
current_attempt: step.currentAttempt,
|
|
132
132
|
created_at: step.createdAt.toISOString(),
|
|
@@ -1 +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","restartFeedback","started_at","startedAt","finished_at","finishedAt"],"mappings":"AAAA,SACEA,sBAAsB,EAMtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AAEpF,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,MAAME,UAAU,OAAOF,MAAME,OAAO,KAAK,WAAWF,MAAME,OAAO,GAAG;IACpE,MAAMC,WAAWH,MAAMG,QAAQ;IAC/B,MAAMC,SAAS,OAAOJ,MAAMI,MAAM,KAAK,WAAWJ,MAAMI,MAAM,GAAGC;IACjE,MAAMC,QAAQ,OAAON,MAAMM,KAAK,KAAK,WAAWN,MAAMM,KAAK,GAAGD;IAC9D,MAAME,SAAS,OAAOP,MAAMO,MAAM,KAAK,WAAWP,MAAMO,MAAM,GAAGF;IACjE,MAAMG,SAASX,sBAAsBY,SAAS,CAACT,MAAMQ,MAAM;IAC3D,MAAME,mBAAmBd,uBAAuBa,SAAS,CAACT,MAAMU,gBAAgB;IAChF,OAAO;QACLR;QACA,GAAIC,aAAa,QAAQ,OAAOA,aAAa,WAAW;YAACQ,WAAWR;QAAQ,IAAI,CAAC,CAAC;QAClF,GAAIC,WAAWC,YAAY,CAAC,IAAI;YAACD;QAAM,CAAC;QACxC,GAAII,OAAOI,OAAO,GAAG;YAACJ,QAAQA,OAAOK,IAAI;QAAA,IAAI,CAAC,CAAC;QAC/C,GAAIP,UAAUD,YAAY,CAAC,IAAI;YAACC;QAAK,CAAC;QACtC,GAAIC,WAAWF,YAAY,CAAC,IAAI;YAACE;QAA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C,UAAUb,eAAec,OAAO;IAClC;AACF;AAEA,OAAO,SAASC,iBAAiBC,OAAoB;IACnD,OAAO;QACLvB,IAAIuB,QAAQvB,EAAE;QACdwB,SAASD,QAAQE,MAAM;QACvBF,SAASA,QAAQA,OAAO;QACxBG,iBAAiBH,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"}
|
|
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(\n step.error,\n step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user',\n ),\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","restartFeedback","started_at","startedAt","finished_at","finishedAt"],"mappings":"AAAA,SACEA,sBAAsB,EAMtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AAEpF,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,MAAME,UAAU,OAAOF,MAAME,OAAO,KAAK,WAAWF,MAAME,OAAO,GAAG;IACpE,MAAMC,WAAWH,MAAMG,QAAQ;IAC/B,MAAMC,SAAS,OAAOJ,MAAMI,MAAM,KAAK,WAAWJ,MAAMI,MAAM,GAAGC;IACjE,MAAMC,QAAQ,OAAON,MAAMM,KAAK,KAAK,WAAWN,MAAMM,KAAK,GAAGD;IAC9D,MAAME,SAAS,OAAOP,MAAMO,MAAM,KAAK,WAAWP,MAAMO,MAAM,GAAGF;IACjE,MAAMG,SAASX,sBAAsBY,SAAS,CAACT,MAAMQ,MAAM;IAC3D,MAAME,mBAAmBd,uBAAuBa,SAAS,CAACT,MAAMU,gBAAgB;IAChF,OAAO;QACLR;QACA,GAAIC,aAAa,QAAQ,OAAOA,aAAa,WAAW;YAACQ,WAAWR;QAAQ,IAAI,CAAC,CAAC;QAClF,GAAIC,WAAWC,YAAY,CAAC,IAAI;YAACD;QAAM,CAAC;QACxC,GAAII,OAAOI,OAAO,GAAG;YAACJ,QAAQA,OAAOK,IAAI;QAAA,IAAI,CAAC,CAAC;QAC/C,GAAIP,UAAUD,YAAY,CAAC,IAAI;YAACC;QAAK,CAAC;QACtC,GAAIC,WAAWF,YAAY,CAAC,IAAI;YAACE;QAAM,CAAC;QACxC,GAAIG,iBAAiBE,OAAO,GAAG;YAACE,oB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;AACF;AAEA,OAAO,SAASC,iBAAiBC,OAAoB;IACnD,OAAO;QACLvB,IAAIuB,QAAQvB,EAAE;QACdwB,SAASD,QAAQE,MAAM;QACvBF,SAASA,QAAQA,OAAO;QACxBG,iBAAiBH,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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { WorkflowRunAttemptDto, WorkflowRunDto } from '@shipfox/api-workflows-dto';
|
|
1
|
+
import type { WorkflowRunAttemptDto, WorkflowRunDto, WorkflowRunListItemDto } from '@shipfox/api-workflows-dto';
|
|
2
2
|
import type { WorkflowRun } from '#core/entities/workflow-run.js';
|
|
3
3
|
import type { WorkflowRunAttempt } from '#core/entities/workflow-run-attempt.js';
|
|
4
|
+
import type { WorkflowRunJobsSummary } from '#db/index.js';
|
|
4
5
|
export declare function toRunDto(run: WorkflowRun, latestAttempt?: number): WorkflowRunDto;
|
|
6
|
+
export declare function toRunListItemDto(run: WorkflowRun, jobs?: WorkflowRunJobsSummary): WorkflowRunListItemDto;
|
|
5
7
|
export declare function toRunAttemptDto(attempt: WorkflowRunAttempt): WorkflowRunAttemptDto;
|
|
6
8
|
//# sourceMappingURL=workflow-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,WAAW,EAA8B,MAAM,gCAAgC,CAAC;AAC7F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,wCAAwC,CAAC;AAC/E,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,cAAc,CAAC;AAEzD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,SAAqB,GAAG,cAAc,CAuB7F;AAID,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,WAAW,EAChB,IAAI,GAAE,sBAAmC,GACxC,sBAAsB,CAYxB;AAgBD,wBAAgB,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,qBAAqB,CAWlF"}
|
|
@@ -3,7 +3,9 @@ export function toRunDto(run, latestAttempt = run.currentAttempt) {
|
|
|
3
3
|
id: run.id,
|
|
4
4
|
project_id: run.projectId,
|
|
5
5
|
definition_id: run.definitionId,
|
|
6
|
+
number: run.number,
|
|
6
7
|
name: run.name,
|
|
8
|
+
workflow_name: run.workflowName,
|
|
7
9
|
status: run.status,
|
|
8
10
|
current_attempt: run.currentAttempt,
|
|
9
11
|
latest_attempt: latestAttempt,
|
|
@@ -11,6 +13,7 @@ export function toRunDto(run, latestAttempt = run.currentAttempt) {
|
|
|
11
13
|
trigger_source: run.triggerSource,
|
|
12
14
|
trigger_event: run.triggerEvent,
|
|
13
15
|
trigger_payload: run.triggerPayload,
|
|
16
|
+
trigger_reference: toTriggerReferenceDto(run.triggerReference),
|
|
14
17
|
inputs: run.inputs,
|
|
15
18
|
source_snapshot: run.sourceSnapshot,
|
|
16
19
|
created_at: run.createdAt.toISOString(),
|
|
@@ -19,6 +22,37 @@ export function toRunDto(run, latestAttempt = run.currentAttempt) {
|
|
|
19
22
|
finished_at: run.finishedAt?.toISOString() ?? null
|
|
20
23
|
};
|
|
21
24
|
}
|
|
25
|
+
const EMPTY_JOBS = {
|
|
26
|
+
preview: [],
|
|
27
|
+
statusCounts: []
|
|
28
|
+
};
|
|
29
|
+
export function toRunListItemDto(run, jobs = EMPTY_JOBS) {
|
|
30
|
+
return {
|
|
31
|
+
...toRunDto(run),
|
|
32
|
+
jobs: jobs.preview.map((job)=>({
|
|
33
|
+
id: job.id,
|
|
34
|
+
key: job.key,
|
|
35
|
+
name: job.name,
|
|
36
|
+
status: job.status,
|
|
37
|
+
position: job.position
|
|
38
|
+
})),
|
|
39
|
+
job_status_counts: jobs.statusCounts.map(({ status, count })=>({
|
|
40
|
+
status,
|
|
41
|
+
count
|
|
42
|
+
}))
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// The persisted reference predates `actor` and carries an internal project id the client has
|
|
46
|
+
// no use for, so each field is read defensively rather than spread onto the response.
|
|
47
|
+
function toTriggerReferenceDto(reference) {
|
|
48
|
+
if (!reference) return null;
|
|
49
|
+
return {
|
|
50
|
+
repository: reference.repository ?? null,
|
|
51
|
+
ref: reference.ref ?? null,
|
|
52
|
+
commit: reference.commit ?? null,
|
|
53
|
+
actor: reference.actor ?? null
|
|
54
|
+
};
|
|
55
|
+
}
|
|
22
56
|
export function toRunAttemptDto(attempt) {
|
|
23
57
|
return {
|
|
24
58
|
id: attempt.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/dto/workflow-run.ts"],"sourcesContent":["import type {WorkflowRunAttemptDto
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/workflow-run.ts"],"sourcesContent":["import type {\n WorkflowRunAttemptDto,\n WorkflowRunDto,\n WorkflowRunListItemDto,\n WorkflowRunTriggerReferenceDto,\n} from '@shipfox/api-workflows-dto';\nimport type {WorkflowRun, WorkflowRunTriggerReference} from '#core/entities/workflow-run.js';\nimport type {WorkflowRunAttempt} from '#core/entities/workflow-run-attempt.js';\nimport type {WorkflowRunJobsSummary} from '#db/index.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 number: run.number,\n name: run.name,\n workflow_name: run.workflowName,\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 trigger_reference: toTriggerReferenceDto(run.triggerReference),\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\nconst EMPTY_JOBS: WorkflowRunJobsSummary = {preview: [], statusCounts: []};\n\nexport function toRunListItemDto(\n run: WorkflowRun,\n jobs: WorkflowRunJobsSummary = EMPTY_JOBS,\n): WorkflowRunListItemDto {\n return {\n ...toRunDto(run),\n jobs: jobs.preview.map((job) => ({\n id: job.id,\n key: job.key,\n name: job.name,\n status: job.status,\n position: job.position,\n })),\n job_status_counts: jobs.statusCounts.map(({status, count}) => ({status, count})),\n };\n}\n\n// The persisted reference predates `actor` and carries an internal project id the client has\n// no use for, so each field is read defensively rather than spread onto the response.\nfunction toTriggerReferenceDto(\n reference: WorkflowRunTriggerReference | null | undefined,\n): WorkflowRunTriggerReferenceDto | null {\n if (!reference) return null;\n return {\n repository: reference.repository ?? null,\n ref: reference.ref ?? null,\n commit: reference.commit ?? null,\n actor: reference.actor ?? 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","number","name","workflow_name","workflowName","status","current_attempt","latest_attempt","trigger_provider","triggerProvider","trigger_source","triggerSource","trigger_event","triggerEvent","trigger_payload","triggerPayload","trigger_reference","toTriggerReferenceDto","triggerReference","inputs","source_snapshot","sourceSnapshot","created_at","createdAt","toISOString","updated_at","updatedAt","started_at","startedAt","finished_at","finishedAt","EMPTY_JOBS","preview","statusCounts","toRunListItemDto","jobs","map","job","key","position","job_status_counts","count","reference","repository","ref","commit","actor","toRunAttemptDto","attempt","workflow_run_id","workflowRunId","rerun_mode","rerunMode"],"mappings":"AAUA,OAAO,SAASA,SAASC,GAAgB,EAAEC,gBAAgBD,IAAIE,cAAc;IAC3E,OAAO;QACLC,IAAIH,IAAIG,EAAE;QACVC,YAAYJ,IAAIK,SAAS;QACzBC,eAAeN,IAAIO,YAAY;QAC/BC,QAAQR,IAAIQ,MAAM;QAClBC,MAAMT,IAAIS,IAAI;QACdC,eAAeV,IAAIW,YAAY;QAC/BC,QAAQZ,IAAIY,MAAM;QAClBC,iBAAiBb,IAAIE,cAAc;QACnCY,gBAAgBb;QAChBc,kBAAkBf,IAAIgB,eAAe;QACrCC,gBAAgBjB,IAAIkB,aAAa;QACjCC,eAAenB,IAAIoB,YAAY;QAC/BC,iBAAiBrB,IAAIsB,cAAc;QACnCC,mBAAmBC,sBAAsBxB,IAAIyB,gBAAgB;QAC7DC,QAAQ1B,IAAI0B,MAAM;QAClBC,iBAAiB3B,IAAI4B,cAAc;QACnCC,YAAY7B,IAAI8B,SAAS,CAACC,WAAW;QACrCC,YAAYhC,IAAIiC,SAAS,CAACF,WAAW;QACrCG,YAAYlC,IAAImC,SAAS,EAAEJ,iBAAiB;QAC5CK,aAAapC,IAAIqC,U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":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAC,4BAA4B,EAAC,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAC,4BAA4B,EAAC,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AA0B/B,wBAAgB,sCAAsC,CAAC,MAAM,EAAE;IAC7D,KAAK,EAAE,sBAAsB,CAAC;IAC9B,WAAW,EAAE,4BAA4B,CAAC;IAC1C,UAAU,EAAE,2BAA2B,CAAC;IACxC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;IACnE,OAAO,EAAE,wBAAwB,CAAC;IAClC,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;CAChC,GAAG,uBAAuB,CAAC,OAAO,4BAA4B,CAAC,CA4G/D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAgClF"}
|
|
@@ -4,6 +4,7 @@ import { createInterModuleKnownError, defineInterModulePresentation } from '@shi
|
|
|
4
4
|
import { DEFAULT_HARNESS, harnessSchema } from '@shipfox/workflow-document';
|
|
5
5
|
import { InvalidJobRunnerLabelsError, WorkspaceDeletedError, WorkspaceNotFoundError, WorkspaceSuspendedError } from '#core/errors.js';
|
|
6
6
|
import { AgentConfigUnresolvableError, AgentIntegrationMaterializationError, DefinitionNotFoundError, InterpolationUnresolvableError, ProjectMismatchError, runWorkflow } from '#core/index.js';
|
|
7
|
+
import { resolveWorkflowRunTriggerReference } from '#core/resolve-trigger-reference.js';
|
|
7
8
|
import { assertWorkspaceAdmitsNewJobs } from '#core/workspace-admission.js';
|
|
8
9
|
import { getJobScope, getStepById, getStepByIdForJobExecution } from '#db/index.js';
|
|
9
10
|
import { deliverEventToListener } from '#db/job-listener-events.js';
|
|
@@ -18,6 +19,7 @@ export function createWorkflowsInterModulePresentation(params) {
|
|
|
18
19
|
projectId: input.projectId,
|
|
19
20
|
definitionId: input.definitionId,
|
|
20
21
|
triggerPayload: input.triggerPayload,
|
|
22
|
+
triggerConnectionId: input.triggerConnectionId,
|
|
21
23
|
inputs: input.inputs,
|
|
22
24
|
triggerIdempotencyKey: input.idempotencyKey,
|
|
23
25
|
integrations: params.integrations,
|
|
@@ -33,15 +35,41 @@ export function createWorkflowsInterModulePresentation(params) {
|
|
|
33
35
|
throw toStartRunKnownError(error, input.definitionId);
|
|
34
36
|
}
|
|
35
37
|
},
|
|
38
|
+
resolveWorkflowRunTriggerReference: async (input)=>await resolveWorkflowRunTriggerReference({
|
|
39
|
+
workspaceId: input.workspaceId,
|
|
40
|
+
triggerConnectionId: input.triggerConnectionId,
|
|
41
|
+
triggerPayload: input.triggerPayload,
|
|
42
|
+
integrations: params.integrations,
|
|
43
|
+
projects: params.projects
|
|
44
|
+
}),
|
|
36
45
|
deliverEventToJobListener: async (input)=>{
|
|
37
46
|
const method = workflowsInterModuleContract.methods.deliverEventToJobListener;
|
|
38
47
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
const scope = input.disposition === 'fire' ? await getJobScope(input.jobId) : undefined;
|
|
49
|
+
if (scope) {
|
|
50
|
+
await assertWorkspaceAdmitsNewJobs(params.workspaces, scope.workspaceId);
|
|
51
|
+
}
|
|
52
|
+
let triggerReference = null;
|
|
53
|
+
if (input.triggerReference !== undefined) {
|
|
54
|
+
triggerReference = input.triggerReference;
|
|
55
|
+
} else if (scope) {
|
|
56
|
+
triggerReference = await resolveWorkflowRunTriggerReference({
|
|
57
|
+
workspaceId: scope.workspaceId,
|
|
58
|
+
triggerConnectionId: input.triggerConnectionId,
|
|
59
|
+
triggerPayload: {
|
|
60
|
+
provider: input.provider,
|
|
61
|
+
source: input.source,
|
|
62
|
+
event: input.event,
|
|
63
|
+
deliveryId: input.deliveryId,
|
|
64
|
+
data: input.payload
|
|
65
|
+
},
|
|
66
|
+
integrations: params.integrations,
|
|
67
|
+
projects: params.projects
|
|
68
|
+
});
|
|
42
69
|
}
|
|
43
70
|
return await deliverEventToListener({
|
|
44
71
|
...input,
|
|
72
|
+
triggerReference,
|
|
45
73
|
receivedAt: new Date(input.receivedAt)
|
|
46
74
|
});
|
|
47
75
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/presentation/inter-module.ts"],"sourcesContent":["import {materializedAgentStepConfigSchema} from '@shipfox/api-agent-dto';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {workflowsInterModuleContract} from '@shipfox/api-workflows-dto/inter-module';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {\n createInterModuleKnownError,\n defineInterModulePresentation,\n type InterModuleKnownErrorFor,\n type InterModulePresentation,\n} from '@shipfox/inter-module';\nimport {DEFAULT_HARNESS, harnessSchema} from '@shipfox/workflow-document';\nimport {\n InvalidJobRunnerLabelsError,\n WorkspaceDeletedError,\n WorkspaceNotFoundError,\n WorkspaceSuspendedError,\n} from '#core/errors.js';\nimport {\n AgentConfigUnresolvableError,\n AgentIntegrationMaterializationError,\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n ProjectMismatchError,\n runWorkflow,\n} from '#core/index.js';\nimport {assertWorkspaceAdmitsNewJobs} from '#core/workspace-admission.js';\nimport {getJobScope, getStepById, getStepByIdForJobExecution} from '#db/index.js';\nimport {deliverEventToListener} from '#db/job-listener-events.js';\n\ntype WorkspaceAdmissionKnownError = InterModuleKnownErrorFor<\n typeof workflowsInterModuleContract.methods.deliverEventToJobListener\n>;\n\nexport function createWorkflowsInterModulePresentation(params: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;\n runners: RunnersInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n}): InterModulePresentation<typeof workflowsInterModuleContract> {\n return defineInterModulePresentation(workflowsInterModuleContract, {\n startRunFromTrigger: async (input) => {\n try {\n await assertWorkspaceAdmitsNewJobs(params.workspaces, input.workspaceId);\n const run = await runWorkflow(\n params.definitions,\n {\n agent: params.agent,\n workspaceId: input.workspaceId,\n projectId: input.projectId,\n definitionId: input.definitionId,\n triggerPayload: input.triggerPayload,\n inputs: input.inputs,\n triggerIdempotencyKey: input.idempotencyKey,\n integrations: params.integrations,\n projects: params.projects,\n },\n {secrets: params.secrets},\n );\n return {id: run.id, name: run.name};\n } catch (error) {\n throw toStartRunKnownError(error, input.definitionId);\n }\n },\n deliverEventToJobListener: async (input) => {\n const method = workflowsInterModuleContract.methods.deliverEventToJobListener;\n try {\n if (input.disposition === 'fire') {\n const scope = await getJobScope(input.jobId);\n if (scope) await assertWorkspaceAdmitsNewJobs(params.workspaces, scope.workspaceId);\n }\n return await deliverEventToListener({...input, receivedAt: new Date(input.receivedAt)});\n } catch (error) {\n const workspaceError = toWorkspaceAdmissionKnownError(method, error);\n if (workspaceError !== undefined) throw workspaceError;\n throw error;\n }\n },\n getStepLogContext: async ({stepId}) => {\n const step = await getStepById(stepId);\n const parsed = harnessSchema.safeParse(step?.config.harness);\n return {harness: parsed.success ? parsed.data : DEFAULT_HARNESS};\n },\n getLeasedAgentToolContext: async (input) => {\n const method = workflowsInterModuleContract.methods.getLeasedAgentToolContext;\n const {active: leaseIsActive} = await params.runners.getLeaseState({\n jobId: input.jobId,\n jobExecutionId: input.jobExecutionId,\n runnerSessionId: input.runnerSessionId,\n });\n if (!leaseIsActive) throw createInterModuleKnownError(method, 'lease-not-active', {});\n\n const step = await getStepByIdForJobExecution({\n stepId: input.stepId,\n jobExecutionId: input.jobExecutionId,\n });\n if (!step) throw createInterModuleKnownError(method, 'step-not-found', {});\n\n const scope = await getJobScope(input.jobId);\n if (!scope) throw createInterModuleKnownError(method, 'job-not-found', {});\n if (step.currentAttempt !== input.attempt) {\n throw createInterModuleKnownError(method, 'step-attempt-mismatch', {});\n }\n if (step.status !== 'running')\n throw createInterModuleKnownError(method, 'step-not-running', {});\n if (step.type !== 'agent')\n throw createInterModuleKnownError(method, 'leased-step-not-agent', {});\n\n const config = materializedAgentStepConfigSchema.safeParse(step.config);\n if (!config.success) {\n throw createInterModuleKnownError(method, 'agent-step-config-invalid', {});\n }\n return {workspaceId: scope.workspaceId, integrations: config.data.integrations ?? []};\n },\n });\n}\n\nexport function toStartRunKnownError(error: unknown, definitionId: string): unknown {\n const method = workflowsInterModuleContract.methods.startRunFromTrigger;\n const workspaceError = toWorkspaceAdmissionKnownError(method, error);\n if (workspaceError !== undefined) return workspaceError;\n if (error instanceof DefinitionNotFoundError) {\n return createInterModuleKnownError(method, 'definition-not-found', {definitionId});\n }\n if (error instanceof ProjectMismatchError) {\n return createInterModuleKnownError(method, 'project-mismatch', {});\n }\n if (error instanceof AgentConfigUnresolvableError) {\n return createInterModuleKnownError(method, 'agent-config-unresolvable', {\n definitionId: error.definitionId,\n });\n }\n if (error instanceof AgentIntegrationMaterializationError) {\n return createInterModuleKnownError(method, 'agent-integration-materialization-failed', {});\n }\n if (error instanceof InterpolationUnresolvableError) {\n return createInterModuleKnownError(method, 'interpolation-unresolvable', {\n definitionId: error.definitionId,\n field: error.field,\n source: error.source,\n ...(error.envKey === undefined ? {} : {envKey: error.envKey}),\n });\n }\n if (error instanceof InvalidJobRunnerLabelsError) {\n return createInterModuleKnownError(method, 'invalid-job-runner-labels', {\n labels: [...error.labels],\n });\n }\n return error;\n}\n\nfunction toWorkspaceAdmissionKnownError(\n method:\n | typeof workflowsInterModuleContract.methods.startRunFromTrigger\n | typeof workflowsInterModuleContract.methods.deliverEventToJobListener,\n error: unknown,\n): WorkspaceAdmissionKnownError | undefined {\n if (error instanceof WorkspaceSuspendedError) {\n return createInterModuleKnownError(method, 'workspace-suspended', {\n workspaceId: error.workspaceId,\n });\n }\n if (error instanceof WorkspaceDeletedError) {\n return createInterModuleKnownError(method, 'workspace-deleted', {\n workspaceId: error.workspaceId,\n });\n }\n if (error instanceof WorkspaceNotFoundError) {\n return createInterModuleKnownError(method, 'workspace-not-found', {\n workspaceId: error.workspaceId,\n });\n }\n return undefined;\n}\n"],"names":["materializedAgentStepConfigSchema","workflowsInterModuleContract","createInterModuleKnownError","defineInterModulePresentation","DEFAULT_HARNESS","harnessSchema","InvalidJobRunnerLabelsError","WorkspaceDeletedError","WorkspaceNotFoundError","WorkspaceSuspendedError","AgentConfigUnresolvableError","AgentIntegrationMaterializationError","DefinitionNotFoundError","InterpolationUnresolvableError","ProjectMismatchError","runWorkflow","assertWorkspaceAdmitsNewJobs","getJobScope","getStepById","getStepByIdForJobExecution","deliverEventToListener","createWorkflowsInterModulePresentation","params","startRunFromTrigger","input","workspaces","workspaceId","run","definitions","agent","projectId","definitionId","triggerPayload","inputs","triggerIdempotencyKey","idempotencyKey","integrations","projects","secrets","id","name","error","toStartRunKnownError","deliverEventToJobListener","method","methods","disposition","scope","jobId","receivedAt","Date","workspaceError","toWorkspaceAdmissionKnownError","undefined","getStepLogContext","stepId","step","parsed","safeParse","config","harness","success","data","getLeasedAgentToolContext","active","leaseIsActive","runners","getLeaseState","jobExecutionId","runnerSessionId","currentAttempt","attempt","status","type","field","source","envKey","labels"],"mappings":"AAAA,SAAQA,iCAAiC,QAAO,yBAAyB;AAOzE,SAAQC,4BAA4B,QAAO,0CAA0C;AAErF,SACEC,2BAA2B,EAC3BC,6BAA6B,QAGxB,wBAAwB;AAC/B,SAAQC,eAAe,EAAEC,aAAa,QAAO,6BAA6B;AAC1E,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,kBAAkB;AACzB,SACEC,4BAA4B,EAC5BC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,WAAW,QACN,iBAAiB;AACxB,SAAQC,4BAA4B,QAAO,+BAA+B;AAC1E,SAAQC,WAAW,EAAEC,WAAW,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,QAAQ,uBAAuB;YAChElB,aAAae,MAAMf,WAAW;QAChC;IACF;IACA,IAAIe,iBAAiBlC,uBAAuB;QAC1C,OAAOL,4BAA4B0C,QAAQ,qBAAqB;YAC9DlB,aAAae,MAAMf,WAAW;QAChC;IACF;IACA,IAAIe,iBAAiBjC,wBAAwB;QAC3C,OAAON,4BAA4B0C,QAAQ,uBAAuB;YAChElB,aAAae,MAAMf,WAAW;QAChC;IACF;IACA,OAAO2B;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../src/presentation/inter-module.ts"],"sourcesContent":["import {materializedAgentStepConfigSchema} from '@shipfox/api-agent-dto';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {workflowsInterModuleContract} from '@shipfox/api-workflows-dto/inter-module';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {\n createInterModuleKnownError,\n defineInterModulePresentation,\n type InterModuleKnownErrorFor,\n type InterModulePresentation,\n} from '@shipfox/inter-module';\nimport {DEFAULT_HARNESS, harnessSchema} from '@shipfox/workflow-document';\nimport type {WorkflowRunTriggerReference} from '#core/entities/workflow-run.js';\nimport {\n InvalidJobRunnerLabelsError,\n WorkspaceDeletedError,\n WorkspaceNotFoundError,\n WorkspaceSuspendedError,\n} from '#core/errors.js';\nimport {\n AgentConfigUnresolvableError,\n AgentIntegrationMaterializationError,\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n ProjectMismatchError,\n runWorkflow,\n} from '#core/index.js';\nimport {resolveWorkflowRunTriggerReference} from '#core/resolve-trigger-reference.js';\nimport {assertWorkspaceAdmitsNewJobs} from '#core/workspace-admission.js';\nimport {getJobScope, getStepById, getStepByIdForJobExecution} from '#db/index.js';\nimport {deliverEventToListener} from '#db/job-listener-events.js';\n\ntype WorkspaceAdmissionKnownError = InterModuleKnownErrorFor<\n typeof workflowsInterModuleContract.methods.deliverEventToJobListener\n>;\n\nexport function createWorkflowsInterModulePresentation(params: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;\n runners: RunnersInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n}): InterModulePresentation<typeof workflowsInterModuleContract> {\n return defineInterModulePresentation(workflowsInterModuleContract, {\n startRunFromTrigger: async (input) => {\n try {\n await assertWorkspaceAdmitsNewJobs(params.workspaces, input.workspaceId);\n const run = await runWorkflow(\n params.definitions,\n {\n agent: params.agent,\n workspaceId: input.workspaceId,\n projectId: input.projectId,\n definitionId: input.definitionId,\n triggerPayload: input.triggerPayload,\n triggerConnectionId: input.triggerConnectionId,\n inputs: input.inputs,\n triggerIdempotencyKey: input.idempotencyKey,\n integrations: params.integrations,\n projects: params.projects,\n },\n {secrets: params.secrets},\n );\n return {id: run.id, name: run.name};\n } catch (error) {\n throw toStartRunKnownError(error, input.definitionId);\n }\n },\n resolveWorkflowRunTriggerReference: async (input) =>\n await resolveWorkflowRunTriggerReference({\n workspaceId: input.workspaceId,\n triggerConnectionId: input.triggerConnectionId,\n triggerPayload: input.triggerPayload,\n integrations: params.integrations,\n projects: params.projects,\n }),\n deliverEventToJobListener: async (input) => {\n const method = workflowsInterModuleContract.methods.deliverEventToJobListener;\n try {\n const scope = input.disposition === 'fire' ? await getJobScope(input.jobId) : undefined;\n if (scope) {\n await assertWorkspaceAdmitsNewJobs(params.workspaces, scope.workspaceId);\n }\n\n let triggerReference: WorkflowRunTriggerReference | null = null;\n if (input.triggerReference !== undefined) {\n triggerReference = input.triggerReference;\n } else if (scope) {\n triggerReference = await resolveWorkflowRunTriggerReference({\n workspaceId: scope.workspaceId,\n triggerConnectionId: input.triggerConnectionId,\n triggerPayload: {\n provider: input.provider,\n source: input.source,\n event: input.event,\n deliveryId: input.deliveryId,\n data: input.payload,\n },\n integrations: params.integrations,\n projects: params.projects,\n });\n }\n return await deliverEventToListener({\n ...input,\n triggerReference,\n receivedAt: new Date(input.receivedAt),\n });\n } catch (error) {\n const workspaceError = toWorkspaceAdmissionKnownError(method, error);\n if (workspaceError !== undefined) throw workspaceError;\n throw error;\n }\n },\n getStepLogContext: async ({stepId}) => {\n const step = await getStepById(stepId);\n const parsed = harnessSchema.safeParse(step?.config.harness);\n return {harness: parsed.success ? parsed.data : DEFAULT_HARNESS};\n },\n getLeasedAgentToolContext: async (input) => {\n const method = workflowsInterModuleContract.methods.getLeasedAgentToolContext;\n const {active: leaseIsActive} = await params.runners.getLeaseState({\n jobId: input.jobId,\n jobExecutionId: input.jobExecutionId,\n runnerSessionId: input.runnerSessionId,\n });\n if (!leaseIsActive) throw createInterModuleKnownError(method, 'lease-not-active', {});\n\n const step = await getStepByIdForJobExecution({\n stepId: input.stepId,\n jobExecutionId: input.jobExecutionId,\n });\n if (!step) throw createInterModuleKnownError(method, 'step-not-found', {});\n\n const scope = await getJobScope(input.jobId);\n if (!scope) throw createInterModuleKnownError(method, 'job-not-found', {});\n if (step.currentAttempt !== input.attempt) {\n throw createInterModuleKnownError(method, 'step-attempt-mismatch', {});\n }\n if (step.status !== 'running')\n throw createInterModuleKnownError(method, 'step-not-running', {});\n if (step.type !== 'agent')\n throw createInterModuleKnownError(method, 'leased-step-not-agent', {});\n\n const config = materializedAgentStepConfigSchema.safeParse(step.config);\n if (!config.success) {\n throw createInterModuleKnownError(method, 'agent-step-config-invalid', {});\n }\n return {workspaceId: scope.workspaceId, integrations: config.data.integrations ?? []};\n },\n });\n}\n\nexport function toStartRunKnownError(error: unknown, definitionId: string): unknown {\n const method = workflowsInterModuleContract.methods.startRunFromTrigger;\n const workspaceError = toWorkspaceAdmissionKnownError(method, error);\n if (workspaceError !== undefined) return workspaceError;\n if (error instanceof DefinitionNotFoundError) {\n return createInterModuleKnownError(method, 'definition-not-found', {definitionId});\n }\n if (error instanceof ProjectMismatchError) {\n return createInterModuleKnownError(method, 'project-mismatch', {});\n }\n if (error instanceof AgentConfigUnresolvableError) {\n return createInterModuleKnownError(method, 'agent-config-unresolvable', {\n definitionId: error.definitionId,\n });\n }\n if (error instanceof AgentIntegrationMaterializationError) {\n return createInterModuleKnownError(method, 'agent-integration-materialization-failed', {});\n }\n if (error instanceof InterpolationUnresolvableError) {\n return createInterModuleKnownError(method, 'interpolation-unresolvable', {\n definitionId: error.definitionId,\n field: error.field,\n source: error.source,\n ...(error.envKey === undefined ? {} : {envKey: error.envKey}),\n });\n }\n if (error instanceof InvalidJobRunnerLabelsError) {\n return createInterModuleKnownError(method, 'invalid-job-runner-labels', {\n labels: [...error.labels],\n });\n }\n return error;\n}\n\nfunction toWorkspaceAdmissionKnownError(\n method:\n | typeof workflowsInterModuleContract.methods.startRunFromTrigger\n | typeof workflowsInterModuleContract.methods.deliverEventToJobListener,\n error: unknown,\n): WorkspaceAdmissionKnownError | undefined {\n if (error instanceof WorkspaceSuspendedError) {\n return createInterModuleKnownError(method, 'workspace-suspended', {\n workspaceId: error.workspaceId,\n });\n }\n if (error instanceof WorkspaceDeletedError) {\n return createInterModuleKnownError(method, 'workspace-deleted', {\n workspaceId: error.workspaceId,\n });\n }\n if (error instanceof WorkspaceNotFoundError) {\n return createInterModuleKnownError(method, 'workspace-not-found', {\n workspaceId: error.workspaceId,\n });\n }\n return undefined;\n}\n"],"names":["materializedAgentStepConfigSchema","workflowsInterModuleContract","createInterModuleKnownError","defineInterModulePresentation","DEFAULT_HARNESS","harnessSchema","InvalidJobRunnerLabelsError","WorkspaceDeletedError","WorkspaceNotFoundError","WorkspaceSuspendedError","AgentConfigUnresolvableError","AgentIntegrationMaterializationError","DefinitionNotFoundError","InterpolationUnresolvableError","ProjectMismatchError","runWorkflow","resolveWorkflowRunTriggerReference","assertWorkspaceAdmitsNewJobs","getJobScope","getStepById","getStepByIdForJobExecution","deliverEventToListener","createWorkflowsInterModulePresentation","params","startRunFromTrigger","input","workspaces","workspaceId","run","definitions","agent","projectId","definitionId","triggerPayload","triggerConnectionId","inputs","triggerIdempotencyKey","idempotencyKey","integrations","projects","secrets","id","name","error","toStartRunKnownError","deliverEventToJobListener","method","methods","scope","disposition","jobId","undefined","triggerReference","provider","source","event","deliveryId","data","payload","receivedAt","Date","workspaceError","toWorkspaceAdmissionKnownError","getStepLogContext","stepId","step","parsed","safeParse","config","harness","success","getLeasedAgentToolContext","active","leaseIsActive","runners","getLeaseState","jobExecutionId","runnerSessionId","currentAttempt","attempt","status","type","field","envKey","labels"],"mappings":"AAAA,SAAQA,iCAAiC,QAAO,yBAAyB;AAOzE,SAAQC,4BAA4B,QAAO,0CAA0C;AAErF,SACEC,2BAA2B,EAC3BC,6BAA6B,QAGxB,wBAAwB;AAC/B,SAAQC,eAAe,EAAEC,aAAa,QAAO,6BAA6B;AAE1E,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,QAClB,kBAAkB;AACzB,SACEC,4BAA4B,EAC5BC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,WAAW,QACN,iBAAiB;AACxB,SAAQC,kCAAkC,QAAO,qCAAqC;AACtF,SAAQC,4BAA4B,QAAO,+BAA+B;AAC1E,SAAQC,WAAW,EAAEC,WAAW,EAAEC,0BAA0B,QAAO,eAAe;AAClF,SAAQC,sBAAsB,QAAO,6BAA6B;AAMlE,OAAO,SAASC,uCAAuCC,MAQtD;IACC,OAAOpB,8BAA8BF,8BAA8B;QACjEuB,qBAAqB,OAAOC;YAC1B,IAAI;gBACF,MAAMR,6BAA6BM,OAAOG,UAAU,EAAED,MAAME,WAAW;gBACvE,MAAMC,MAAM,M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,IAAIH,iBAAiB9B,gCAAgC;QACnD,OAAOX,4BAA4B4C,QAAQ,8BAA8B;YACvEd,cAAcW,MAAMX,YAAY;YAChCkD,OAAOvC,MAAMuC,KAAK;YAClB5B,QAAQX,MAAMW,MAAM;YACpB,GAAIX,MAAMwC,MAAM,KAAKhC,YAAY,CAAC,IAAI;gBAACgC,QAAQxC,MAAMwC,MAAM;YAAA,CAAC;QAC9D;IACF;IACA,IAAIxC,iBAAiBrC,6BAA6B;QAChD,OAAOJ,4BAA4B4C,QAAQ,6BAA6B;YACtEsC,QAAQ;mBAAIzC,MAAMyC,MAAM;aAAC;QAC3B;IACF;IACA,OAAOzC;AACT;AAEA,SAASmB,+BACPhB,MAEyE,EACzEH,KAAc;IAEd,IAAIA,iBAAiBlC,yBAAyB;QAC5C,OAAOP,4BAA4B4C,QAAQ,uBAAuB;YAChEnB,aAAagB,MAAMhB,WAAW;QAChC;IACF;IACA,IAAIgB,iBAAiBpC,uBAAuB;QAC1C,OAAOL,4BAA4B4C,QAAQ,qBAAqB;YAC9DnB,aAAagB,MAAMhB,WAAW;QAChC;IACF;IACA,IAAIgB,iBAAiBnC,wBAAwB;QAC3C,OAAON,4BAA4B4C,QAAQ,uBAAuB;YAChEnB,aAAagB,MAAMhB,WAAW;QAChC;IACF;IACA,OAAOwB;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IntegrationsModuleClient } from '@shipfox/api-integration-core-dto/inter-module';
|
|
2
|
-
import type
|
|
2
|
+
import { type ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
|
|
3
3
|
import type { RunnersInterModuleClient } from '@shipfox/api-runners-dto/inter-module';
|
|
4
4
|
export declare function createCheckoutTokenRoute(clients: {
|
|
5
5
|
runners: RunnersInterModuleClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-token.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/checkout-token.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkout-token.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/checkout-token.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAapF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,OAAO,EAAE,wBAAwB,CAAC;IAClC,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;CAChC,mDA6HA"}
|