@shipfox/api-workflows 11.0.0 → 12.1.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 +107 -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/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 +19 -19
- 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/checkout-token.test.ts +357 -142
- package/src/presentation/routes/checkout-token.ts +56 -26
- package/src/presentation/routes/get-run.test.ts +2 -0
- 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-runs.test.ts +57 -0
- 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/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
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
$ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
|
|
2
|
-
Successfully compiled:
|
|
3
|
-
2026-
|
|
2
|
+
Successfully compiled: 119 files with swc (757.97ms)
|
|
3
|
+
2026-08-04T14:51:31.477Z [INFO] asset workflow-bundle-a5487a6112facdf4dd9d.js 3.32 MiB [emitted] [immutable] (name: main)
|
|
4
4
|
orphan modules 33.5 KiB [orphan] 21 modules
|
|
5
5
|
runtime modules 1.13 KiB 5 modules
|
|
6
6
|
modules by path ../../../node_modules/.pnpm/ 970 KiB 196 modules
|
|
7
|
-
modules by path ./dist/
|
|
8
|
-
modules by path ./dist/temporal/
|
|
9
|
-
modules by path ./dist/temporal/workflows/*.js
|
|
7
|
+
modules by path ./dist/ 41.2 KiB
|
|
8
|
+
modules by path ./dist/temporal/ 36.1 KiB
|
|
9
|
+
modules by path ./dist/temporal/workflows/*.js 34.8 KiB 5 modules
|
|
10
10
|
+ 2 modules
|
|
11
11
|
modules by path ./dist/core/ 5.11 KiB
|
|
12
12
|
./dist/core/job-execution-outcome.js 1010 bytes [built] [code generated]
|
|
@@ -16,6 +16,6 @@ optional modules 30 bytes [optional]
|
|
|
16
16
|
__temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
17
17
|
__temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
18
18
|
../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
|
|
19
|
-
webpack 5.107.2 compiled successfully in
|
|
20
|
-
2026-
|
|
21
|
-
/home/runner/work/shipfox/shipfox/libs/api/workflows/dist/temporal/workflows/index.js:
|
|
19
|
+
webpack 5.107.2 compiled successfully in 7052 ms
|
|
20
|
+
2026-08-04T14:51:31.488Z [INFO] Workflow bundle created { size: '3.32MB' }
|
|
21
|
+
/home/runner/work/shipfox/shipfox/libs/api/workflows/dist/temporal/workflows/index.js: 3476109 bytes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
# @shipfox/api-workflows
|
|
2
2
|
|
|
3
|
+
## 12.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [312a137]
|
|
8
|
+
- @shipfox/api-workflows-dto@12.1.0
|
|
9
|
+
|
|
10
|
+
## 12.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- adf07e7: Cut over workflow and job display names to literal-only `name` fields, with runtime interpolation supported through `run_name` and `execution_name`.
|
|
15
|
+
- 032d316: Scope checkout credential minting to the currently running checkout step and return its fetch depth.
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- ee2ce67: Accept a `${{ }}` interpolation in an agent step's `thinking` field. The schema
|
|
20
|
+
still offers the per-harness enum for editor completion, and the dispatcher
|
|
21
|
+
checks the resolved value against the harness levels. An unsupported
|
|
22
|
+
resolved level fails the step.
|
|
23
|
+
- 5d2c9cf: Carry checkout steps from workflow normalization through step materialization and surface their setup error category.
|
|
24
|
+
- f7939c7: Add resolved checkout details as a dedicated step-report field.
|
|
25
|
+
- 9e1d599: Carry first-checkout intent through workflow normalization and step materialization for the upcoming runner checkout execution, including implicit-checkout suppression, checkout opt-out, and position-based primary checkout placement.
|
|
26
|
+
- dea1ffd: Expose normalized repository references on listening execution events.
|
|
27
|
+
- 285fff2: Persist resolved workflow job execution names and handle dynamic naming failures consistently.
|
|
28
|
+
- e44a279: Persist nullable resolved workflow run-name overrides alongside static workflow-name snapshots.
|
|
29
|
+
- 54c820e: Add the trigger reference and the current attempt's jobs to each workflow run in the run list response.
|
|
30
|
+
|
|
31
|
+
`trigger_reference` carries the repository, ref, commit, and actor a source-control trigger resolved, or null for triggers that resolve none. Jobs arrive as `jobs`, a preview bounded by the new `WORKFLOW_RUN_JOB_PREVIEW_LIMIT`, alongside `job_status_counts` covering every job of the attempt including those past the preview.
|
|
32
|
+
|
|
33
|
+
- 35a42bd: Resolve run and agent step working directories against the runner job workspace.
|
|
34
|
+
- d77baaa: Add per-definition sequential numbers to workflow runs and expose them in the API and expression context.
|
|
35
|
+
- c2a8e54: Normalize checkout target fields for step-dispatch resolution, reject unsupported job-level checkout fields, and keep the workflow model and runtime checkout contracts aligned.
|
|
36
|
+
- cb0abfa: Expose the normalized trigger project, repository, ref, and commit in workflow context.
|
|
37
|
+
- ee2ce67: Split workflow definition facts out of the `run` context into a `workflow` root.
|
|
38
|
+
`run.workflow_name` becomes `workflow.name` and `run.definition_id` becomes
|
|
39
|
+
`workflow.id`, so `workflow` and `run` mirror the `job` and `execution` pair.
|
|
40
|
+
Add `contextRootsForField` to return the readable roots for a predicate or an
|
|
41
|
+
interpolation field without requiring the caller to choose a mechanism. Add
|
|
42
|
+
`workflowContextDocs` as the reader-facing description of every root and property.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- 7c4116e: Align predicate property types with their runtime shapes, replace `run.run_name` with `run.workflow_name`, and remove `failed` from `executions` entries.
|
|
47
|
+
- 0bb880a: Transition job executions from pending to running when the runner claims them.
|
|
48
|
+
- f78740d: Remove Unicode dash punctuation from package prose and source comments.
|
|
49
|
+
- 4d246d4: Align predicate validation and runtime evaluation with field-specific context contracts.
|
|
50
|
+
- 66f111e: Snapshots referenced workflow variables for predicate evaluation at run creation.
|
|
51
|
+
- 53ce6b2: Materialize primary checkout credential persistence on the setup step.
|
|
52
|
+
- 5d267c3: Re-materialize checkout policy from the workflow model when re-running a job.
|
|
53
|
+
- 9e39069: Defaults same-project checkout steps to the workflow trigger commit while preserving explicit refs and cross-repository defaults.
|
|
54
|
+
- Updated dependencies [ee2ce67]
|
|
55
|
+
- Updated dependencies [7c4116e]
|
|
56
|
+
- Updated dependencies [5d2c9cf]
|
|
57
|
+
- Updated dependencies [e95fdf4]
|
|
58
|
+
- Updated dependencies [3d91d1d]
|
|
59
|
+
- Updated dependencies [f7939c7]
|
|
60
|
+
- Updated dependencies [89f2c18]
|
|
61
|
+
- Updated dependencies [045895c]
|
|
62
|
+
- Updated dependencies [f78740d]
|
|
63
|
+
- Updated dependencies [9e1d599]
|
|
64
|
+
- Updated dependencies [dea1ffd]
|
|
65
|
+
- Updated dependencies [adf07e7]
|
|
66
|
+
- Updated dependencies [94aba88]
|
|
67
|
+
- Updated dependencies [3f781ee]
|
|
68
|
+
- Updated dependencies [9fdd5e4]
|
|
69
|
+
- Updated dependencies [285fff2]
|
|
70
|
+
- Updated dependencies [e44a279]
|
|
71
|
+
- Updated dependencies [4d246d4]
|
|
72
|
+
- Updated dependencies [4eb18b8]
|
|
73
|
+
- Updated dependencies [28daafe]
|
|
74
|
+
- Updated dependencies [f13e8bb]
|
|
75
|
+
- Updated dependencies [9ebc5b4]
|
|
76
|
+
- Updated dependencies [4444079]
|
|
77
|
+
- Updated dependencies [869a792]
|
|
78
|
+
- Updated dependencies [8cc5a36]
|
|
79
|
+
- Updated dependencies [54c820e]
|
|
80
|
+
- Updated dependencies [35a42bd]
|
|
81
|
+
- Updated dependencies [d77baaa]
|
|
82
|
+
- Updated dependencies [41d558c]
|
|
83
|
+
- Updated dependencies [032d316]
|
|
84
|
+
- Updated dependencies [c2a8e54]
|
|
85
|
+
- Updated dependencies [54c820e]
|
|
86
|
+
- Updated dependencies [cb0abfa]
|
|
87
|
+
- Updated dependencies [ee2ce67]
|
|
88
|
+
- Updated dependencies [7f90b0c]
|
|
89
|
+
- Updated dependencies [e1efaee]
|
|
90
|
+
- @shipfox/workflow-document@3.0.0
|
|
91
|
+
- @shipfox/api-definitions-dto@12.0.0
|
|
92
|
+
- @shipfox/api-workflows-dto@12.0.0
|
|
93
|
+
- @shipfox/api-agent-dto@12.0.0
|
|
94
|
+
- @shipfox/expression@2.0.0
|
|
95
|
+
- @shipfox/api-auth-dto@12.0.0
|
|
96
|
+
- @shipfox/inter-module@0.2.3
|
|
97
|
+
- @shipfox/node-fastify@0.4.1
|
|
98
|
+
- @shipfox/node-module@1.0.5
|
|
99
|
+
- @shipfox/api-workspaces-dto@12.0.0
|
|
100
|
+
- @shipfox/api-projects-dto@12.0.0
|
|
101
|
+
- @shipfox/api-integration-core-dto@12.0.0
|
|
102
|
+
- @shipfox/node-postgres@0.5.0
|
|
103
|
+
- @shipfox/api-auth-context@12.0.0
|
|
104
|
+
- @shipfox/annotations-dto@12.0.0
|
|
105
|
+
- @shipfox/api-runners-dto@12.0.0
|
|
106
|
+
- @shipfox/api-secrets-dto@12.0.0
|
|
107
|
+
- @shipfox/node-drizzle@0.3.5
|
|
108
|
+
- @shipfox/node-outbox@0.2.6
|
|
109
|
+
|
|
3
110
|
## 11.0.0
|
|
4
111
|
|
|
5
112
|
### Major Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Shipfox API Workflows
|
|
2
|
+
|
|
3
|
+
Shipfox API Workflows creates and runs workflow definitions, jobs, executions, steps, and run history.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
- **`createWorkflowsModule`**: Registers workflow routes, persistence, events, subscribers, and orchestration.
|
|
8
|
+
- **`runWorkflow`**: Loads a definition and creates a run with its initial graph.
|
|
9
|
+
- **`WorkflowRun`**: Represents a run with UUID identity, status, trigger data, and display fields.
|
|
10
|
+
- **`loadRunningLeasedStep`**: Loads the step state available to a leased runner.
|
|
11
|
+
|
|
12
|
+
## Installation / Setup
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add @shipfox/api-workflows
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The module requires the Auth, Definitions, Integrations, Projects, Runners,
|
|
19
|
+
Secrets, Workspaces, Annotations, and Agent inter-module clients.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import {runWorkflow} from '@shipfox/api-workflows';
|
|
25
|
+
|
|
26
|
+
const run = await runWorkflow(definitions, {
|
|
27
|
+
agent,
|
|
28
|
+
workspaceId,
|
|
29
|
+
projectId,
|
|
30
|
+
definitionId,
|
|
31
|
+
triggerPayload: {
|
|
32
|
+
source: 'manual',
|
|
33
|
+
event: 'fire',
|
|
34
|
+
subscriptionId,
|
|
35
|
+
userId,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Routes / API / Data Model
|
|
41
|
+
|
|
42
|
+
Workflow routes keep UUIDs in path and query parameters. The run response
|
|
43
|
+
includes both `id` and `number`. The UUID identifies the run. The number is a
|
|
44
|
+
display label and workflow expression value.
|
|
45
|
+
|
|
46
|
+
## Behavior Notes
|
|
47
|
+
|
|
48
|
+
Run numbers are sequential within one workflow definition, start at `1`, and
|
|
49
|
+
are unique for `(definition_id, number)`. The Workflows module allocates the
|
|
50
|
+
number with a per-definition counter inside the run-creation transaction. It
|
|
51
|
+
resolves trigger idempotency before allocation, so a duplicate delivery returns
|
|
52
|
+
the original run without consuming another number.
|
|
53
|
+
|
|
54
|
+
Gaps are acceptable because the number is a label and monotonicity matters more
|
|
55
|
+
than density. Counter rows stay after a definition is removed, and reruns create
|
|
56
|
+
another attempt on the same run without consuming a number.
|
|
57
|
+
|
|
58
|
+
Run numbers are never addresses. No route resolves a run by its number, and run
|
|
59
|
+
URLs continue to use the run UUID. A run number is useful in workflow
|
|
60
|
+
expressions as `run.number` and should appear beside the workflow name when it is
|
|
61
|
+
shown in a list.
|
|
62
|
+
|
|
63
|
+
## Development
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
turbo check --filter=@shipfox/api-workflows
|
|
67
|
+
turbo type --filter=@shipfox/api-workflows
|
|
68
|
+
turbo test --filter=@shipfox/api-workflows
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
DB-backed workflow tests need local Postgres from `docker compose up -d`.
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
|
@@ -5,7 +5,8 @@ export interface AgentDefaultsInput {
|
|
|
5
5
|
readonly harness?: Harness | undefined;
|
|
6
6
|
readonly provider?: ModelProviderRef | undefined;
|
|
7
7
|
readonly model?: string | undefined;
|
|
8
|
-
|
|
8
|
+
/** A resolved template can carry any string. The agent module validates it. */
|
|
9
|
+
readonly thinking?: string | undefined;
|
|
9
10
|
}
|
|
10
11
|
export interface ResolvedAgentDefaults {
|
|
11
12
|
readonly harness: Harness;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-defaults.d.ts","sourceRoot":"","sources":["../../src/core/agent-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,aAAa,EAAE,OAAO,EAAC,MAAM,4BAA4B,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"agent-defaults.d.ts","sourceRoot":"","sources":["../../src/core/agent-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,aAAa,EAAE,OAAO,EAAC,MAAM,4BAA4B,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CAClC;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,KAAK,EAAE,kBAAkB,KACtB,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAE5D,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,sBAAsB,EAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,qBAAqB,CAWvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/agent-defaults.ts"],"sourcesContent":["import type {ModelProviderRef} from '@shipfox/api-agent-dto';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AgentThinking, Harness} from '@shipfox/workflow-document';\n\nexport interface AgentDefaultsInput {\n readonly harness?: Harness | undefined;\n readonly provider?: ModelProviderRef | undefined;\n readonly model?: string | undefined;\n readonly thinking?:
|
|
1
|
+
{"version":3,"sources":["../../src/core/agent-defaults.ts"],"sourcesContent":["import type {ModelProviderRef} from '@shipfox/api-agent-dto';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AgentThinking, Harness} from '@shipfox/workflow-document';\n\nexport interface AgentDefaultsInput {\n readonly harness?: Harness | undefined;\n readonly provider?: ModelProviderRef | undefined;\n readonly model?: string | undefined;\n /** A resolved template can carry any string. The agent module validates it. */\n readonly thinking?: string | undefined;\n}\n\nexport interface ResolvedAgentDefaults {\n readonly harness: Harness;\n readonly provider: ModelProviderRef;\n readonly model: string;\n readonly thinking: AgentThinking;\n}\n\nexport type AgentDefaultsResolver = (\n input: AgentDefaultsInput,\n) => ResolvedAgentDefaults | Promise<ResolvedAgentDefaults>;\n\nexport function createAgentDefaultsResolver(\n agent: AgentInterModuleClient,\n workspaceId: string | null,\n): AgentDefaultsResolver {\n return async (config) =>\n await agent.resolveAgentConfig({\n workspaceId,\n config: {\n ...(config.harness === undefined ? {} : {harness: config.harness}),\n ...(config.provider === undefined ? {} : {provider: config.provider}),\n ...(config.model === undefined ? {} : {model: config.model}),\n ...(config.thinking === undefined ? {} : {thinking: config.thinking}),\n },\n });\n}\n"],"names":["createAgentDefaultsResolver","agent","workspaceId","config","resolveAgentConfig","harness","undefined","provider","model","thinking"],"mappings":"AAuBA,OAAO,SAASA,4BACdC,KAA6B,EAC7BC,WAA0B;IAE1B,OAAO,OAAOC,SACZ,MAAMF,MAAMG,kBAAkB,CAAC;YAC7BF;YACAC,QAAQ;gBACN,GAAIA,OAAOE,OAAO,KAAKC,YAAY,CAAC,IAAI;oBAACD,SAASF,OAAOE,OAAO;gBAAA,CAAC;gBACjE,GAAIF,OAAOI,QAAQ,KAAKD,YAAY,CAAC,IAAI;oBAACC,UAAUJ,OAAOI,QAAQ;gBAAA,CAAC;gBACpE,GAAIJ,OAAOK,KAAK,KAAKF,YAAY,CAAC,IAAI;oBAACE,OAAOL,OAAOK,KAAK;gBAAA,CAAC;gBAC3D,GAAIL,OAAOM,QAAQ,KAAKH,YAAY,CAAC,IAAI;oBAACG,UAAUN,OAAOM,QAAQ;gBAAA,CAAC;YACtE;QACF;AACJ"}
|
package/dist/core/checkout.d.ts
CHANGED
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto/inter-module';
|
|
2
2
|
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
|
|
3
|
-
|
|
3
|
+
import type { Step } from '#core/entities/step.js';
|
|
4
|
+
import type { WorkflowRunTriggerReference } from '#core/entities/workflow-run.js';
|
|
5
|
+
export declare function createStepCheckoutSpec({ step, workspaceId, projectId, triggerReference, integrations, projects, }: {
|
|
6
|
+
step: Step;
|
|
4
7
|
workspaceId: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
persistCredentials: boolean;
|
|
8
|
-
permissions: {
|
|
9
|
-
contents: 'read' | 'write';
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Resolves what to check out for a job, keyed off the authoritative `jobId`
|
|
14
|
-
* (`workflowRunId`/`workflowRunAttemptId`/`workspaceId` in the lease claim are informational).
|
|
15
|
-
* Chain: job → attempt → run → project source metadata. Credential-free.
|
|
16
|
-
*/
|
|
17
|
-
export declare function resolveCheckoutIntent(jobId: string, projects: ProjectsModuleClient): Promise<CheckoutIntent>;
|
|
18
|
-
/**
|
|
19
|
-
* Resolves the job's checkout intent and exchanges it for a short-lived,
|
|
20
|
-
* scoped checkout spec. Omitting `ref` lets the provider use the repository's
|
|
21
|
-
* default branch while preserving the JSON-only inter-module boundary.
|
|
22
|
-
*/
|
|
23
|
-
export declare function createJobCheckoutSpec({ jobId, integrations, projects, }: {
|
|
24
|
-
jobId: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
triggerReference?: WorkflowRunTriggerReference | null | undefined;
|
|
25
10
|
integrations: IntegrationsModuleClient;
|
|
26
11
|
projects: ProjectsModuleClient;
|
|
27
12
|
}): Promise<{
|
|
@@ -38,6 +23,7 @@ export declare function createJobCheckoutSpec({ jobId, integrations, projects, }
|
|
|
38
23
|
email: string;
|
|
39
24
|
};
|
|
40
25
|
};
|
|
26
|
+
fetchDepth: number;
|
|
41
27
|
persistCredentials: boolean;
|
|
42
28
|
}>;
|
|
43
29
|
//# sourceMappingURL=checkout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/core/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/core/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAGjF,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,gCAAgC,CAAC;AA+BhF,wBAAsB,sBAAsB,CAAC,EAC3C,IAAI,EACJ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,CAAC;IAClE,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAAC;IACV,IAAI,EAAE;QACJ,aAAa,EAAE,MAAM,CAAC;QACtB,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,IAAI,CAAA;SAAC,CAAC;QACjE,SAAS,CAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,CAAC;KAC3C,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC,CAoDD"}
|
package/dist/core/checkout.js
CHANGED
|
@@ -1,54 +1,135 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { checkoutTargetValidationIssues } from '@shipfox/workflow-document';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CheckoutConfigInvalidError, CheckoutIntentUnresolvedError } from './errors.js';
|
|
4
|
+
const checkoutConfigSchema = z.object({
|
|
5
|
+
project: z.string().uuid().optional(),
|
|
6
|
+
connection: z.string().min(1).optional(),
|
|
7
|
+
repository: z.string().min(1).optional(),
|
|
8
|
+
ref: z.string().min(1).optional(),
|
|
9
|
+
fetch_depth: z.number().int().nonnegative().optional(),
|
|
10
|
+
permissions: z.object({
|
|
11
|
+
contents: z.enum([
|
|
12
|
+
'read',
|
|
13
|
+
'write'
|
|
14
|
+
])
|
|
15
|
+
}).optional(),
|
|
16
|
+
persist_credentials: z.boolean().optional()
|
|
17
|
+
}).superRefine((checkout, context)=>{
|
|
18
|
+
for (const validationIssue of checkoutTargetValidationIssues(checkout)){
|
|
19
|
+
const message = validationIssue.kind === 'project-with-connection' ? 'Checkout project cannot be combined with a connection.' : validationIssue.kind === 'project-with-repository' ? 'Checkout project cannot be combined with a repository.' : 'Checkout connection requires a repository.';
|
|
20
|
+
context.addIssue({
|
|
21
|
+
code: 'custom',
|
|
22
|
+
path: [
|
|
23
|
+
validationIssue.path
|
|
24
|
+
],
|
|
25
|
+
message
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export async function createStepCheckoutSpec({ step, workspaceId, projectId, triggerReference, integrations, projects }) {
|
|
30
|
+
const checkout = parseCheckoutConfig(step);
|
|
31
|
+
const { project: defaultProject } = await projects.getProjectById({
|
|
32
|
+
projectId
|
|
14
33
|
});
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
if (defaultProject === null || defaultProject === undefined) {
|
|
35
|
+
throw new CheckoutIntentUnresolvedError({
|
|
36
|
+
kind: 'project',
|
|
37
|
+
value: projectId
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const target = await checkoutTarget({
|
|
41
|
+
checkout,
|
|
42
|
+
defaultProjectId: projectId,
|
|
43
|
+
defaultConnectionId: defaultProject.sourceConnectionId,
|
|
44
|
+
integrations,
|
|
45
|
+
workspaceId
|
|
46
|
+
});
|
|
47
|
+
const resolvedTarget = await projects.resolveCheckoutTarget({
|
|
48
|
+
workspaceId,
|
|
49
|
+
defaults: {
|
|
50
|
+
connectionId: defaultProject.sourceConnectionId,
|
|
51
|
+
owner: defaultOwner(defaultProject.sourceRepositoryOwner, checkout.repository)
|
|
52
|
+
},
|
|
53
|
+
target
|
|
54
|
+
});
|
|
55
|
+
const ref = checkout.ref ?? (triggerReference?.project?.id === resolvedTarget.projectId ? triggerReference.commit ?? undefined : undefined);
|
|
30
56
|
const response = await integrations.createCheckoutSpec({
|
|
31
|
-
workspaceId
|
|
32
|
-
connectionId:
|
|
33
|
-
externalRepositoryId:
|
|
34
|
-
|
|
57
|
+
workspaceId,
|
|
58
|
+
connectionId: resolvedTarget.connectionId,
|
|
59
|
+
externalRepositoryId: resolvedTarget.externalRepositoryId,
|
|
60
|
+
...ref === undefined ? {} : {
|
|
61
|
+
ref
|
|
62
|
+
},
|
|
63
|
+
permissions: checkout.permissions ?? {
|
|
64
|
+
contents: 'read'
|
|
65
|
+
}
|
|
35
66
|
});
|
|
36
|
-
const { credentials, gitAuthor, ...checkout } = response;
|
|
37
67
|
return {
|
|
38
68
|
spec: {
|
|
39
|
-
|
|
40
|
-
|
|
69
|
+
repositoryUrl: response.repositoryUrl,
|
|
70
|
+
ref: response.ref,
|
|
71
|
+
...response.credentials ? {
|
|
41
72
|
credentials: {
|
|
42
|
-
...credentials,
|
|
43
|
-
expiresAt: new Date(credentials.expiresAt)
|
|
73
|
+
...response.credentials,
|
|
74
|
+
expiresAt: new Date(response.credentials.expiresAt)
|
|
44
75
|
}
|
|
45
76
|
} : {},
|
|
46
|
-
...gitAuthor ? {
|
|
47
|
-
gitAuthor
|
|
48
|
-
}
|
|
77
|
+
...response.gitAuthor === undefined ? {} : {
|
|
78
|
+
gitAuthor: response.gitAuthor
|
|
79
|
+
}
|
|
49
80
|
},
|
|
50
|
-
|
|
81
|
+
fetchDepth: checkout.fetch_depth ?? 1,
|
|
82
|
+
persistCredentials: checkout.persist_credentials ?? true
|
|
51
83
|
};
|
|
52
84
|
}
|
|
85
|
+
function parseCheckoutConfig(step) {
|
|
86
|
+
const result = checkoutConfigSchema.safeParse(step.config.checkout);
|
|
87
|
+
if (!result.success) {
|
|
88
|
+
throw new CheckoutConfigInvalidError(step.id);
|
|
89
|
+
}
|
|
90
|
+
return result.data;
|
|
91
|
+
}
|
|
92
|
+
async function checkoutTarget(params) {
|
|
93
|
+
const { checkout } = params;
|
|
94
|
+
if (checkout.project !== undefined) return {
|
|
95
|
+
project: checkout.project
|
|
96
|
+
};
|
|
97
|
+
if (checkout.repository !== undefined) {
|
|
98
|
+
const connection = checkout.connection === undefined ? undefined : await resolveConnectionId({
|
|
99
|
+
integrations: params.integrations,
|
|
100
|
+
workspaceId: params.workspaceId,
|
|
101
|
+
defaultConnectionId: params.defaultConnectionId,
|
|
102
|
+
slug: checkout.connection
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
...connection === undefined ? {} : {
|
|
106
|
+
connection
|
|
107
|
+
},
|
|
108
|
+
repository: checkout.repository
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
project: params.defaultProjectId
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
async function resolveConnectionId(params) {
|
|
116
|
+
const connection = await params.integrations.resolveConnection({
|
|
117
|
+
workspaceId: params.workspaceId,
|
|
118
|
+
slug: params.slug
|
|
119
|
+
});
|
|
120
|
+
if (connection === null) {
|
|
121
|
+
throw new CheckoutIntentUnresolvedError({
|
|
122
|
+
kind: 'connection',
|
|
123
|
+
value: params.slug
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return connection.id;
|
|
127
|
+
}
|
|
128
|
+
function defaultOwner(projectOwner, repository) {
|
|
129
|
+
if (projectOwner) return projectOwner;
|
|
130
|
+
const separator = repository?.indexOf('/') ?? -1;
|
|
131
|
+
if (separator > 0 && repository !== undefined) return repository.slice(0, separator);
|
|
132
|
+
return 'unknown';
|
|
133
|
+
}
|
|
53
134
|
|
|
54
135
|
//# sourceMappingURL=checkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/checkout.ts"],"sourcesContent":["import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {getJobById, getWorkflowRunByAttemptId} from '#db/workflow-runs.js';\nimport {\n CheckoutIntentUnresolvedError,\n JobNotFoundError,\n WorkflowRunNotFoundError,\n} from './errors.js';\n\nexport interface CheckoutIntent {\n workspaceId: string;\n connectionId: string;\n externalRepositoryId: string;\n persistCredentials: boolean;\n permissions: {contents: 'read' | 'write'};\n}\n\n/**\n * Resolves what to check out for a job, keyed off the authoritative `jobId`\n * (`workflowRunId`/`workflowRunAttemptId`/`workspaceId` in the lease claim are informational).\n * Chain: job → attempt → run → project source metadata. Credential-free.\n */\nexport async function resolveCheckoutIntent(\n jobId: string,\n projects: ProjectsModuleClient,\n): Promise<CheckoutIntent> {\n const job = await getJobById(jobId);\n if (!job) throw new JobNotFoundError(jobId);\n\n const run = await getWorkflowRunByAttemptId(job.workflowRunAttemptId);\n if (!run) throw new WorkflowRunNotFoundError(job.workflowRunAttemptId);\n\n const {project} = await projects.getProjectById({projectId: run.projectId});\n if (project === null) throw new CheckoutIntentUnresolvedError(run.projectId);\n\n return {\n workspaceId: project.workspaceId,\n connectionId: project.sourceConnectionId,\n externalRepositoryId: project.sourceExternalRepositoryId,\n persistCredentials: job.checkout.persistCredentials,\n permissions: job.checkout.permissions,\n };\n}\n\n/**\n * Resolves the job's checkout intent and exchanges it for a short-lived,\n * scoped checkout spec. Omitting `ref` lets the provider use the repository's\n * default branch while preserving the JSON-only inter-module boundary.\n */\nexport async function createJobCheckoutSpec({\n jobId,\n integrations,\n projects,\n}: {\n jobId: string;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n}): Promise<{\n spec: {\n repositoryUrl: string;\n ref: string;\n credentials?: {username: string; token: string; expiresAt: Date};\n gitAuthor?: {name: string; email: string};\n };\n persistCredentials: boolean;\n}> {\n const intent = await resolveCheckoutIntent(jobId, projects);\n const response = await integrations.createCheckoutSpec({\n workspaceId: intent.workspaceId,\n connectionId: intent.connectionId,\n externalRepositoryId: intent.externalRepositoryId,\n permissions: intent.permissions,\n });\n const {credentials, gitAuthor, ...checkout} = response;\n return {\n spec: {\n ...checkout,\n ...(credentials\n ? {\n credentials: {\n ...credentials,\n expiresAt: new Date(credentials.expiresAt),\n },\n }\n : {}),\n ...(gitAuthor ? {gitAuthor} : {}),\n },\n persistCredentials: intent.persistCredentials,\n };\n}\n"],"names":["getJobById","getWorkflowRunByAttemptId","CheckoutIntentUnresolvedError","JobNotFoundError","WorkflowRunNotFoundError","resolveCheckoutIntent","jobId","projects","job","run","workflowRunAttemptId","project","getProjectById","projectId","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","persistCredentials","checkout","permissions","createJobCheckoutSpec","integrations","intent","response","createCheckoutSpec","credentials","gitAuthor","spec","expiresAt","Date"],"mappings":"AAEA,S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gBAC3C;YACF,IACA,CAAC,CAAC;YACN,GAAIF,YAAY;gBAACA;YAAS,IAAI,CAAC,CAAC;QAClC;QACAT,oBAAoBK,OAAOL,kBAAkB;IAC/C;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/checkout.ts"],"sourcesContent":["import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {checkoutTargetValidationIssues} from '@shipfox/workflow-document';\nimport {z} from 'zod';\nimport type {Step} from '#core/entities/step.js';\nimport type {WorkflowRunTriggerReference} from '#core/entities/workflow-run.js';\nimport {CheckoutConfigInvalidError, CheckoutIntentUnresolvedError} from './errors.js';\n\nconst checkoutConfigSchema = z\n .object({\n project: z.string().uuid().optional(),\n connection: z.string().min(1).optional(),\n repository: z.string().min(1).optional(),\n ref: z.string().min(1).optional(),\n fetch_depth: z.number().int().nonnegative().optional(),\n permissions: z.object({contents: z.enum(['read', 'write'])}).optional(),\n persist_credentials: z.boolean().optional(),\n })\n .superRefine((checkout, context) => {\n for (const validationIssue of checkoutTargetValidationIssues(checkout)) {\n const message =\n validationIssue.kind === 'project-with-connection'\n ? 'Checkout project cannot be combined with a connection.'\n : validationIssue.kind === 'project-with-repository'\n ? 'Checkout project cannot be combined with a repository.'\n : 'Checkout connection requires a repository.';\n context.addIssue({\n code: 'custom',\n path: [validationIssue.path],\n message,\n });\n }\n });\n\ntype CheckoutConfig = z.infer<typeof checkoutConfigSchema>;\n\nexport async function createStepCheckoutSpec({\n step,\n workspaceId,\n projectId,\n triggerReference,\n integrations,\n projects,\n}: {\n step: Step;\n workspaceId: string;\n projectId: string;\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n}): Promise<{\n spec: {\n repositoryUrl: string;\n ref: string;\n credentials?: {username: string; token: string; expiresAt: Date};\n gitAuthor?: {name: string; email: string};\n };\n fetchDepth: number;\n persistCredentials: boolean;\n}> {\n const checkout = parseCheckoutConfig(step);\n const {project: defaultProject} = await projects.getProjectById({projectId});\n if (defaultProject === null || defaultProject === undefined) {\n throw new CheckoutIntentUnresolvedError({kind: 'project', value: projectId});\n }\n\n const target = await checkoutTarget({\n checkout,\n defaultProjectId: projectId,\n defaultConnectionId: defaultProject.sourceConnectionId,\n integrations,\n workspaceId,\n });\n const resolvedTarget = await projects.resolveCheckoutTarget({\n workspaceId,\n defaults: {\n connectionId: defaultProject.sourceConnectionId,\n owner: defaultOwner(defaultProject.sourceRepositoryOwner, checkout.repository),\n },\n target,\n });\n const ref =\n checkout.ref ??\n (triggerReference?.project?.id === resolvedTarget.projectId\n ? (triggerReference.commit ?? undefined)\n : undefined);\n const response = await integrations.createCheckoutSpec({\n workspaceId,\n connectionId: resolvedTarget.connectionId,\n externalRepositoryId: resolvedTarget.externalRepositoryId,\n ...(ref === undefined ? {} : {ref}),\n permissions: checkout.permissions ?? {contents: 'read'},\n });\n\n return {\n spec: {\n repositoryUrl: response.repositoryUrl,\n ref: response.ref,\n ...(response.credentials\n ? {\n credentials: {\n ...response.credentials,\n expiresAt: new Date(response.credentials.expiresAt),\n },\n }\n : {}),\n ...(response.gitAuthor === undefined ? {} : {gitAuthor: response.gitAuthor}),\n },\n fetchDepth: checkout.fetch_depth ?? 1,\n persistCredentials: checkout.persist_credentials ?? true,\n };\n}\n\nfunction parseCheckoutConfig(step: Step): CheckoutConfig {\n const result = checkoutConfigSchema.safeParse(step.config.checkout);\n if (!result.success) {\n throw new CheckoutConfigInvalidError(step.id);\n }\n return result.data;\n}\n\nasync function checkoutTarget(params: {\n checkout: CheckoutConfig;\n defaultProjectId: string;\n defaultConnectionId: string;\n integrations: IntegrationsModuleClient;\n workspaceId: string;\n}) {\n const {checkout} = params;\n if (checkout.project !== undefined) return {project: checkout.project};\n if (checkout.repository !== undefined) {\n const connection =\n checkout.connection === undefined\n ? undefined\n : await resolveConnectionId({\n integrations: params.integrations,\n workspaceId: params.workspaceId,\n defaultConnectionId: params.defaultConnectionId,\n slug: checkout.connection,\n });\n return {\n ...(connection === undefined ? {} : {connection}),\n repository: checkout.repository,\n };\n }\n return {project: params.defaultProjectId};\n}\n\nasync function resolveConnectionId(params: {\n integrations: IntegrationsModuleClient;\n workspaceId: string;\n defaultConnectionId: string;\n slug: string;\n}): Promise<string> {\n const connection = await params.integrations.resolveConnection({\n workspaceId: params.workspaceId,\n slug: params.slug,\n });\n if (connection === null) {\n throw new CheckoutIntentUnresolvedError({kind: 'connection', value: params.slug});\n }\n return connection.id;\n}\n\nfunction defaultOwner(\n projectOwner: string | null | undefined,\n repository: string | undefined,\n): string {\n if (projectOwner) return projectOwner;\n const separator = repository?.indexOf('/') ?? -1;\n if (separator > 0 && repository !== undefined) return repository.slice(0, separator);\n return 'unknown';\n}\n"],"names":["checkoutTargetValidationIssues","z","CheckoutConfigInvalidError","CheckoutIntentUnresolvedError","checkoutConfigSchema","object","project","string","uuid","optional","connection","min","repository","ref","fetch_depth","number","int","nonnegative","permissions","contents","enum","persist_credentials","boolean","superRefine","checkout","context","validationIssue","message","kind","addIssue","code","path","createStepCheckoutSpec","step","workspaceId","projectId","triggerReference","integrations","projects","parseCheckoutConfig","defaultProject","getProjectById","undefined","value","target","checkoutTarget","defaultProjectId","defaultConnectionId","sourceConnectionId","resolvedTarget","resolveCheckoutTarget","defaults","connectionId","owner","defaultOwner","sourceRepositoryOwner","id","commit","response","createCheckoutSpec","externalRepositoryId","spec","repositoryUrl","credentials","expiresAt","Date","gitAuthor","fetchDepth","persistCredentials","result","safeParse","config","success","data","params","resolveConnectionId","slug","resolveConnection","projectOwner","separator","indexOf","slice"],"mappings":"AAEA,SAAQA,8BAA8B,QAAO,6BAA6B;AAC1E,SAAQC,CAAC,QAAO,MAAM;AAGtB,SAAQC,0BAA0B,EAAEC,6BAA6B,QAAO,cAAc;AAEtF,MAAMC,uBAAuBH,EAC1BI,MAAM,CAAC;IACNC,SAASL,EAAEM,MAAM,GAAGC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AAW,OAAO;QAACpC,SAASkB,SAASlB,OAAO;IAAA;IACrE,IAAIkB,SAASZ,UAAU,KAAK8B,WAAW;QACrC,MAAMhC,aACJc,SAASd,UAAU,KAAKgC,YACpBA,YACA,MAAMiC,oBAAoB;YACxBtC,cAAcqC,OAAOrC,YAAY;YACjCH,aAAawC,OAAOxC,WAAW;YAC/Ba,qBAAqB2B,OAAO3B,mBAAmB;YAC/C6B,MAAMpD,SAASd,UAAU;QAC3B;QACN,OAAO;YACL,GAAIA,eAAegC,YAAY,CAAC,IAAI;gBAAChC;YAAU,CAAC;YAChDE,YAAYY,SAASZ,UAAU;QACjC;IACF;IACA,OAAO;QAACN,SAASoE,OAAO5B,gBAAgB;IAAA;AAC1C;AAEA,eAAe6B,oBAAoBD,MAKlC;IACC,MAAMhE,aAAa,MAAMgE,OAAOrC,YAAY,CAACwC,iBAAiB,CAAC;QAC7D3C,aAAawC,OAAOxC,WAAW;QAC/B0C,MAAMF,OAAOE,IAAI;IACnB;IACA,IAAIlE,eAAe,MAAM;QACvB,MAAM,IAAIP,8BAA8B;YAACyB,MAAM;YAAce,OAAO+B,OAAOE,IAAI;QAAA;IACjF;IACA,OAAOlE,WAAW8C,EAAE;AACtB;AAEA,SAASF,aACPwB,YAAuC,EACvClE,UAA8B;IAE9B,IAAIkE,cAAc,OAAOA;IACzB,MAAMC,YAAYnE,YAAYoE,QAAQ,QAAQ,CAAC;IAC/C,IAAID,YAAY,KAAKnE,eAAe8B,WAAW,OAAO9B,WAAWqE,KAAK,CAAC,GAAGF;IAC1E,OAAO;AACT"}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type { JobStatus, JobStatusReason } from './job.js';
|
|
2
2
|
import type { PersistedEvaluationTraceEntry } from './step.js';
|
|
3
|
+
import type { WorkflowRunTriggerReference } from './workflow-run.js';
|
|
3
4
|
export type JobExecutionStatus = Exclude<JobStatus, 'skipped'>;
|
|
4
5
|
export interface WorkflowExecutionEvent {
|
|
5
6
|
source: string;
|
|
6
7
|
event: string;
|
|
7
8
|
delivery_id: string;
|
|
8
9
|
received_at: string;
|
|
10
|
+
project: WorkflowRunTriggerReference['project'];
|
|
11
|
+
repository: WorkflowRunTriggerReference['repository'];
|
|
12
|
+
ref: WorkflowRunTriggerReference['ref'];
|
|
13
|
+
commit: WorkflowRunTriggerReference['commit'];
|
|
9
14
|
data: unknown;
|
|
10
15
|
}
|
|
16
|
+
export declare function normalizeWorkflowExecutionEvent(event: Omit<WorkflowExecutionEvent, 'project' | 'repository' | 'ref' | 'commit'> & Partial<Pick<WorkflowExecutionEvent, 'project' | 'repository' | 'ref' | 'commit'>>): WorkflowExecutionEvent;
|
|
11
17
|
export interface JobExecution {
|
|
12
18
|
id: string;
|
|
13
19
|
jobId: string;
|
|
14
20
|
sequence: number;
|
|
21
|
+
/** A dynamically resolved name; null means use the parent job's fallback. */
|
|
22
|
+
nameOverride: string | null;
|
|
15
23
|
name: string;
|
|
16
24
|
runner: string[] | null;
|
|
17
25
|
status: JobExecutionStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-execution.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"job-execution.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,WAAW,CAAC;AAC7D,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,mBAAmB,CAAC;AAEnE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAE/D,MAAM,WAAW,sBA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;IACtB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export function normalizeWorkflowExecutionEvent(event) {
|
|
2
|
+
return {
|
|
3
|
+
source: event.source,
|
|
4
|
+
event: event.event,
|
|
5
|
+
delivery_id: event.delivery_id,
|
|
6
|
+
received_at: event.received_at,
|
|
7
|
+
project: event.project ?? null,
|
|
8
|
+
repository: event.repository ?? null,
|
|
9
|
+
ref: event.ref ?? null,
|
|
10
|
+
commit: event.commit ?? null,
|
|
11
|
+
data: event.data
|
|
12
|
+
};
|
|
13
|
+
}
|
|
2
14
|
|
|
3
15
|
//# sourceMappingURL=job-execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/job-execution.ts"],"sourcesContent":["import type {JobStatus, JobStatusReason} from './job.js';\nimport type {PersistedEvaluationTraceEntry} from './step.js';\n\nexport type JobExecutionStatus = Exclude<JobStatus, 'skipped'>;\n\nexport interface WorkflowExecutionEvent {\n source: string;\n event: string;\n delivery_id: string;\n received_at: string;\n data: unknown;\n}\n\nexport interface JobExecution {\n id: string;\n jobId: string;\n sequence: number;\n name: string;\n runner: string[] | null;\n status: JobExecutionStatus;\n statusReason: JobStatusReason | null;\n triggerEvents: WorkflowExecutionEvent[];\n outputs: Record<string, unknown> | null;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n queuedAt: Date | null;\n startedAt: Date | null;\n finishedAt: Date | null;\n timedOutAt: Date | null;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/job-execution.ts"],"sourcesContent":["import type {JobStatus, JobStatusReason} from './job.js';\nimport type {PersistedEvaluationTraceEntry} from './step.js';\nimport type {WorkflowRunTriggerReference} from './workflow-run.js';\n\nexport type JobExecutionStatus = Exclude<JobStatus, 'skipped'>;\n\nexport interface WorkflowExecutionEvent {\n source: string;\n event: string;\n delivery_id: string;\n received_at: string;\n project: WorkflowRunTriggerReference['project'];\n repository: WorkflowRunTriggerReference['repository'];\n ref: WorkflowRunTriggerReference['ref'];\n commit: WorkflowRunTriggerReference['commit'];\n data: unknown;\n}\n\nexport function normalizeWorkflowExecutionEvent(\n event: Omit<WorkflowExecutionEvent, 'project' | 'repository' | 'ref' | 'commit'> &\n Partial<Pick<WorkflowExecutionEvent, 'project' | 'repository' | 'ref' | 'commit'>>,\n): WorkflowExecutionEvent {\n return {\n source: event.source,\n event: event.event,\n delivery_id: event.delivery_id,\n received_at: event.received_at,\n project: event.project ?? null,\n repository: event.repository ?? null,\n ref: event.ref ?? null,\n commit: event.commit ?? null,\n data: event.data,\n };\n}\n\nexport interface JobExecution {\n id: string;\n jobId: string;\n sequence: number;\n /** A dynamically resolved name; null means use the parent job's fallback. */\n nameOverride: string | null;\n name: string;\n runner: string[] | null;\n status: JobExecutionStatus;\n statusReason: JobStatusReason | null;\n triggerEvents: WorkflowExecutionEvent[];\n outputs: Record<string, unknown> | null;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n queuedAt: Date | null;\n startedAt: Date | null;\n finishedAt: Date | null;\n timedOutAt: Date | null;\n}\n"],"names":["normalizeWorkflowExecutionEvent","event","source","delivery_id","received_at","project","repository","ref","commit","data"],"mappings":"AAkBA,OAAO,SAASA,gCACdC,KACoF;IAEpF,OAAO;QACLC,QAAQD,MAAMC,MAAM;QACpBD,OAAOA,MAAMA,KAAK;QAClBE,aAAaF,MAAME,WAAW;QAC9BC,aAAaH,MAAMG,WAAW;QAC9BC,SAASJ,MAAMI,OAAO,IAAI;QAC1BC,YAAYL,MAAMK,UAAU,IAAI;QAChCC,KAAKN,MAAMM,GAAG,IAAI;QAClBC,QAAQP,MAAMO,MAAM,IAAI;QACxBC,MAAMR,MAAMQ,IAAI;IAClB;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WorkflowRunTriggerReference } from './workflow-run.js';
|
|
1
2
|
export type JobListenerEventDisposition = 'fire' | 'resolve';
|
|
2
3
|
export interface JobListenerEvent {
|
|
3
4
|
id: string;
|
|
@@ -7,6 +8,7 @@ export interface JobListenerEvent {
|
|
|
7
8
|
deliveryId: string;
|
|
8
9
|
source: string;
|
|
9
10
|
event: string;
|
|
11
|
+
triggerReference: WorkflowRunTriggerReference | null;
|
|
10
12
|
payload: unknown;
|
|
11
13
|
receivedAt: Date;
|
|
12
14
|
consumedByExecutionId: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-listener-event.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job-listener-event.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,2BAA2B,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;IACjB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
1
|
+
{"version":3,"file":"job-listener-event.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job-listener-event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,mBAAmB,CAAC;AAEnE,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,2BAA2B,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,2BAA2B,GAAG,IAAI,CAAC;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;IACjB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/job-listener-event.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/job-listener-event.ts"],"sourcesContent":["import type {WorkflowRunTriggerReference} from './workflow-run.js';\n\nexport type JobListenerEventDisposition = 'fire' | 'resolve';\n\nexport interface JobListenerEvent {\n id: string;\n jobId: string;\n disposition: JobListenerEventDisposition;\n eventRef: string;\n deliveryId: string;\n source: string;\n event: string;\n triggerReference: WorkflowRunTriggerReference | null;\n payload: unknown;\n receivedAt: Date;\n consumedByExecutionId: string | null;\n createdAt: Date;\n}\n"],"names":[],"mappings":"AAIA,WAaC"}
|