@shipfox/api-workflows 4.0.0 → 6.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 +4 -4
- package/CHANGELOG.md +104 -0
- package/dist/core/agent-defaults.d.ts +17 -0
- package/dist/core/agent-defaults.d.ts.map +1 -0
- package/dist/core/agent-defaults.js +21 -0
- package/dist/core/agent-defaults.js.map +1 -0
- package/dist/core/agent-tool-capability-warning.d.ts +4 -0
- package/dist/core/agent-tool-capability-warning.d.ts.map +1 -1
- package/dist/core/agent-tool-capability-warning.js +15 -17
- package/dist/core/agent-tool-capability-warning.js.map +1 -1
- package/dist/core/agent-tools.d.ts +11 -9
- package/dist/core/agent-tools.d.ts.map +1 -1
- package/dist/core/agent-tools.js +23 -18
- package/dist/core/agent-tools.js.map +1 -1
- package/dist/core/checkout.d.ts +21 -7
- package/dist/core/checkout.d.ts.map +1 -1
- package/dist/core/checkout.js +23 -11
- package/dist/core/checkout.js.map +1 -1
- package/dist/core/entities/workflow-run-attempt.d.ts +1 -1
- 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/job-execution.d.ts +3 -1
- package/dist/core/job-execution.d.ts.map +1 -1
- package/dist/core/job-execution.js +14 -12
- package/dist/core/job-execution.js.map +1 -1
- package/dist/core/job-transition/derive-job-execution-outputs.d.ts +1 -1
- package/dist/core/job-transition/derive-job-execution-outputs.d.ts.map +1 -1
- package/dist/core/job-transition/derive-job-execution-outputs.js.map +1 -1
- package/dist/core/job-transition/derive-job-success.js +1 -1
- package/dist/core/job-transition/derive-job-success.js.map +1 -1
- package/dist/core/listener-execution-materialization.d.ts +3 -3
- package/dist/core/listener-execution-materialization.d.ts.map +1 -1
- package/dist/core/listener-execution-materialization.js +3 -4
- package/dist/core/listener-execution-materialization.js.map +1 -1
- package/dist/core/run-workflow.d.ts +12 -1
- package/dist/core/run-workflow.d.ts.map +1 -1
- package/dist/core/run-workflow.js +13 -8
- package/dist/core/run-workflow.js.map +1 -1
- package/dist/core/step-config/agent.d.ts +8 -8
- package/dist/core/step-config/agent.d.ts.map +1 -1
- package/dist/core/step-config/agent.js +12 -10
- package/dist/core/step-config/agent.js.map +1 -1
- package/dist/core/step-config/complete-step-dispatch-config.d.ts +4 -4
- package/dist/core/step-config/complete-step-dispatch-config.d.ts.map +1 -1
- package/dist/core/step-config/complete-step-dispatch-config.js +2 -2
- package/dist/core/step-config/complete-step-dispatch-config.js.map +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.d.ts +3 -3
- package/dist/core/step-config/materialize-job-execution-steps.d.ts.map +1 -1
- package/dist/core/step-config/materialize-job-execution-steps.js +5 -6
- 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 +4 -4
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
- package/dist/core/step-config/resolve-job-execution-name.d.ts +1 -1
- package/dist/core/step-config/resolve-job-execution-name.d.ts.map +1 -1
- package/dist/core/step-config/resolve-job-execution-name.js.map +1 -1
- package/dist/core/step-config/resolve-step-config.d.ts +4 -4
- package/dist/core/step-config/resolve-step-config.d.ts.map +1 -1
- package/dist/core/step-config/resolve-step-config.js +6 -6
- package/dist/core/step-config/resolve-step-config.js.map +1 -1
- package/dist/core/step-config/run.d.ts +1 -1
- package/dist/core/step-config/run.d.ts.map +1 -1
- package/dist/core/step-config/run.js.map +1 -1
- package/dist/core/workflow-run-creation.d.ts +3 -3
- package/dist/core/workflow-run-creation.d.ts.map +1 -1
- package/dist/core/workflow-run-creation.js +3 -4
- package/dist/core/workflow-run-creation.js.map +1 -1
- package/dist/db/db.d.ts +16 -4
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/job-listeners.d.ts +7 -1
- package/dist/db/job-listeners.d.ts.map +1 -1
- package/dist/db/job-listeners.js +10 -5
- package/dist/db/job-listeners.js.map +1 -1
- package/dist/db/runner-lease-table.d.ts +5 -5
- package/dist/db/runner-lease-table.d.ts.map +1 -1
- package/dist/db/runner-lease-table.js +3 -2
- package/dist/db/runner-lease-table.js.map +1 -1
- package/dist/db/schema/workflow-run-attempts.d.ts +9 -3
- package/dist/db/schema/workflow-run-attempts.d.ts.map +1 -1
- package/dist/db/schema/workflow-run-attempts.js +2 -1
- package/dist/db/schema/workflow-run-attempts.js.map +1 -1
- package/dist/db/schema/workflow-runs.js +1 -1
- package/dist/db/schema/workflow-runs.js.map +1 -1
- package/dist/db/workflow-runs/job-executions.d.ts +5 -0
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
- package/dist/db/workflow-runs/job-executions.js +14 -7
- package/dist/db/workflow-runs/job-executions.js.map +1 -1
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +3 -1
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/db/workflow-runs/run-create.d.ts +9 -2
- package/dist/db/workflow-runs/run-create.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-create.js +12 -9
- 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 +3 -1
- package/dist/db/workflow-runs/run-rerun.js.map +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -37
- package/dist/index.js.map +1 -1
- package/dist/presentation/dto/checkout-token.d.ts +14 -1
- package/dist/presentation/dto/checkout-token.d.ts.map +1 -1
- package/dist/presentation/dto/checkout-token.js.map +1 -1
- package/dist/presentation/index.d.ts +1 -1
- package/dist/presentation/index.d.ts.map +1 -1
- package/dist/presentation/index.js +1 -1
- package/dist/presentation/index.js.map +1 -1
- package/dist/presentation/inter-module.d.ts +18 -0
- package/dist/presentation/inter-module.d.ts.map +1 -0
- package/dist/presentation/inter-module.js +113 -0
- package/dist/presentation/inter-module.js.map +1 -0
- package/dist/presentation/routes/agent-runtime-config.d.ts +6 -1
- package/dist/presentation/routes/agent-runtime-config.d.ts.map +1 -1
- package/dist/presentation/routes/agent-runtime-config.js +59 -57
- package/dist/presentation/routes/agent-runtime-config.js.map +1 -1
- package/dist/presentation/routes/cancel-run.d.ts +2 -1
- package/dist/presentation/routes/cancel-run.d.ts.map +1 -1
- package/dist/presentation/routes/cancel-run.js +37 -34
- package/dist/presentation/routes/cancel-run.js.map +1 -1
- package/dist/presentation/routes/checkout-token.d.ts +8 -1
- package/dist/presentation/routes/checkout-token.d.ts.map +1 -1
- package/dist/presentation/routes/checkout-token.js +65 -47
- package/dist/presentation/routes/checkout-token.js.map +1 -1
- package/dist/presentation/routes/get-run-aggregates.d.ts +2 -1
- package/dist/presentation/routes/get-run-aggregates.d.ts.map +1 -1
- package/dist/presentation/routes/get-run-aggregates.js +44 -53
- package/dist/presentation/routes/get-run-aggregates.js.map +1 -1
- package/dist/presentation/routes/get-run.d.ts +2 -1
- package/dist/presentation/routes/get-run.d.ts.map +1 -1
- package/dist/presentation/routes/get-run.js +53 -50
- package/dist/presentation/routes/get-run.js.map +1 -1
- package/dist/presentation/routes/get-step-secrets.d.ts +3 -1
- package/dist/presentation/routes/get-step-secrets.d.ts.map +1 -1
- package/dist/presentation/routes/get-step-secrets.js +72 -68
- package/dist/presentation/routes/get-step-secrets.js.map +1 -1
- package/dist/presentation/routes/index.d.ts +19 -2
- package/dist/presentation/routes/index.d.ts.map +1 -1
- package/dist/presentation/routes/index.js +38 -30
- package/dist/presentation/routes/index.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 +1 -2
- package/dist/presentation/routes/leased-step.js.map +1 -1
- package/dist/presentation/routes/list-run-attempts.d.ts +2 -1
- package/dist/presentation/routes/list-run-attempts.d.ts.map +1 -1
- package/dist/presentation/routes/list-run-attempts.js +29 -26
- package/dist/presentation/routes/list-run-attempts.js.map +1 -1
- package/dist/presentation/routes/list-runs.d.ts +2 -1
- package/dist/presentation/routes/list-runs.d.ts.map +1 -1
- package/dist/presentation/routes/list-runs.js +51 -60
- package/dist/presentation/routes/list-runs.js.map +1 -1
- package/dist/presentation/routes/next-step.d.ts +10 -1
- package/dist/presentation/routes/next-step.d.ts.map +1 -1
- package/dist/presentation/routes/next-step.js +64 -50
- package/dist/presentation/routes/next-step.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +10 -0
- package/dist/presentation/routes/project-access.d.ts.map +1 -0
- package/dist/presentation/routes/project-access.js +17 -0
- package/dist/presentation/routes/project-access.js.map +1 -0
- package/dist/presentation/routes/report-step.d.ts +2 -1
- package/dist/presentation/routes/report-step.d.ts.map +1 -1
- package/dist/presentation/routes/report-step.js +62 -61
- package/dist/presentation/routes/report-step.js.map +1 -1
- package/dist/presentation/routes/require-accessible-run.d.ts +3 -1
- package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -1
- package/dist/presentation/routes/require-accessible-run.js +3 -6
- package/dist/presentation/routes/require-accessible-run.js.map +1 -1
- package/dist/presentation/routes/rerun-run.d.ts +2 -1
- package/dist/presentation/routes/rerun-run.d.ts.map +1 -1
- package/dist/presentation/routes/rerun-run.js +46 -43
- package/dist/presentation/routes/rerun-run.js.map +1 -1
- package/dist/temporal/activities/index.d.ts +44 -9
- package/dist/temporal/activities/index.d.ts.map +1 -1
- package/dist/temporal/activities/index.js +13 -9
- package/dist/temporal/activities/index.js.map +1 -1
- package/dist/temporal/activities/orchestration-activities.d.ts +20 -11
- package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
- package/dist/temporal/activities/orchestration-activities.js +48 -33
- package/dist/temporal/activities/orchestration-activities.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +41 -44
- package/src/core/agent-defaults.test.ts +28 -0
- package/src/core/agent-defaults.ts +36 -0
- package/src/core/agent-tool-capability-warning.test.ts +36 -11
- package/src/core/agent-tool-capability-warning.ts +27 -25
- package/src/core/agent-tools.ts +33 -36
- package/src/core/checkout.test.ts +38 -25
- package/src/core/checkout.ts +41 -14
- package/src/core/entities/workflow-run-attempt.ts +1 -1
- package/src/core/job-execution.ts +19 -9
- package/src/core/job-transition/derive-job-execution-outputs.ts +1 -1
- package/src/core/job-transition/derive-job-success.ts +1 -1
- package/src/core/listener-execution-materialization.test.ts +4 -2
- package/src/core/listener-execution-materialization.ts +6 -9
- package/src/core/run-workflow.test.ts +43 -38
- package/src/core/run-workflow.ts +26 -9
- package/src/core/step-config/agent.ts +24 -26
- package/src/core/step-config/complete-step-dispatch-config.test.ts +22 -23
- package/src/core/step-config/complete-step-dispatch-config.ts +6 -6
- package/src/core/step-config/materialize-job-execution-steps.test.ts +34 -23
- package/src/core/step-config/materialize-job-execution-steps.ts +38 -39
- package/src/core/step-config/materialize-workflow-model.test.ts +94 -82
- package/src/core/step-config/materialize-workflow-model.ts +31 -29
- package/src/core/step-config/resolve-job-execution-name.ts +1 -1
- package/src/core/step-config/resolve-step-config.ts +11 -9
- package/src/core/step-config/run.ts +1 -1
- package/src/core/workflow-run-creation.test.ts +14 -10
- package/src/core/workflow-run-creation.ts +6 -9
- package/src/db/job-listeners.ts +20 -5
- package/src/db/runner-lease-table.ts +2 -2
- package/src/db/schema/workflow-run-attempts.ts +7 -3
- package/src/db/schema/workflow-runs.ts +1 -1
- package/src/db/workflow-runs/job-executions.ts +15 -1
- package/src/db/workflow-runs/jobs.ts +4 -1
- package/src/db/workflow-runs/run-create.test.ts +7 -1
- package/src/db/workflow-runs/run-create.ts +25 -15
- package/src/db/workflow-runs/run-rerun.test.ts +1 -1
- package/src/db/workflow-runs/run-rerun.ts +6 -3
- package/src/index.ts +75 -33
- package/src/presentation/dto/checkout-token.ts +7 -1
- package/src/presentation/index.ts +1 -1
- package/src/presentation/inter-module.test.ts +149 -0
- package/src/presentation/inter-module.ts +132 -0
- package/src/presentation/routes/agent-runtime-config.test.ts +53 -10
- package/src/presentation/routes/agent-runtime-config.ts +89 -64
- package/src/presentation/routes/cancel-run.test.ts +10 -20
- package/src/presentation/routes/cancel-run.ts +30 -27
- package/src/presentation/routes/checkout-token.test.ts +52 -33
- package/src/presentation/routes/checkout-token.ts +109 -49
- package/src/presentation/routes/get-run-aggregates.test.ts +13 -7
- package/src/presentation/routes/get-run-aggregates.ts +54 -57
- package/src/presentation/routes/get-run.test.ts +10 -18
- package/src/presentation/routes/get-run.ts +51 -48
- package/src/presentation/routes/get-step-secrets.test.ts +29 -7
- package/src/presentation/routes/get-step-secrets.ts +72 -61
- package/src/presentation/routes/index.test.ts +16 -1
- package/src/presentation/routes/index.ts +54 -29
- package/src/presentation/routes/leased-step.ts +3 -2
- package/src/presentation/routes/list-run-attempts.test.ts +9 -19
- package/src/presentation/routes/list-run-attempts.ts +21 -18
- package/src/presentation/routes/list-runs.test.ts +13 -7
- package/src/presentation/routes/list-runs.ts +64 -67
- package/src/presentation/routes/next-step.test.ts +30 -11
- package/src/presentation/routes/next-step.ts +68 -48
- package/src/presentation/routes/project-access.ts +16 -0
- package/src/presentation/routes/report-step.test.ts +18 -2
- package/src/presentation/routes/report-step.ts +51 -49
- package/src/presentation/routes/require-accessible-run.ts +5 -2
- package/src/presentation/routes/rerun-run.test.ts +9 -19
- package/src/presentation/routes/rerun-run.ts +39 -36
- package/src/temporal/activities/index.ts +32 -12
- package/src/temporal/activities/orchestration-activities.test.ts +10 -8
- package/src/temporal/activities/orchestration-activities.ts +74 -50
- package/src/temporal/workflows/job-execution-orchestration.test.ts +47 -2
- package/test/env.ts +1 -3
- package/test/factories/project.ts +10 -5
- package/test/factories/workflow-model.test.ts +5 -1
- package/test/factories/workflow-model.ts +1 -1
- package/test/factories/workflow-run.ts +1 -1
- package/test/fixtures/agent-inter-module.ts +27 -0
- package/test/fixtures/annotations-inter-module.ts +5 -0
- package/test/fixtures/auth-inter-module.ts +22 -0
- package/test/fixtures/lease-token.ts +2 -1
- package/test/fixtures/projects-inter-module.ts +8 -0
- package/test/fixtures/runners-inter-module.ts +52 -0
- package/test/fixtures/secrets-inter-module.ts +61 -0
- package/test/globalSetup.ts +11 -11
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/core/source-control.d.ts +0 -5
- package/dist/core/source-control.d.ts.map +0 -1
- package/dist/core/source-control.js +0 -19
- package/dist/core/source-control.js.map +0 -1
- package/src/core/source-control.test.ts +0 -17
- package/src/core/source-control.ts +0 -22
- package/src/temporal/workflows/job-execution-orchestration-timeout.test.ts +0 -165
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/routes/report-step.ts"],"sourcesContent":["import {requireLeasedJobContext} from '@shipfox/api-auth-context';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/routes/report-step.ts"],"sourcesContent":["import {requireLeasedJobContext} from '@shipfox/api-auth-context';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport {reportStepBodySchema, reportStepResponseSchema} from '@shipfox/api-workflows-dto';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {z} from 'zod';\nimport {StepAttemptAheadError, StepNotFoundError, StepNotRunningError} from '#core/errors.js';\nimport {recordStepResult} from '#core/job-execution.js';\nimport {fromStepErrorDto} from '#presentation/dto/step.js';\n\nexport function createReportStepRoute(runners: RunnersInterModuleClient) {\n return defineRoute({\n method: 'POST',\n path: '/steps/:stepId/report',\n description:\n 'Reports whether a step succeeded or failed. The job is identified by the access token. Reporting the same step more than once is safe: once a step has finished, later reports for it are ignored. The runner does not call a separate job-completion endpoint — finalization is driven server-side from the recorded step results, and the `cancel` flag tells the runner to stop once the job has finished without full success.',\n schema: {\n params: z.object({stepId: z.string().uuid()}),\n body: reportStepBodySchema,\n response: {\n 200: reportStepResponseSchema,\n },\n },\n errorHandler: (error) => {\n if (error instanceof StepNotFoundError) {\n throw new ClientError(error.message, 'step-not-found', {status: 404});\n }\n if (error instanceof StepNotRunningError) {\n throw new ClientError(error.message, 'step-not-running', {status: 409});\n }\n if (error instanceof StepAttemptAheadError) {\n throw new ClientError(error.message, 'step-attempt-ahead', {status: 409});\n }\n throw error;\n },\n handler: async (request) => {\n const {stepId} = request.params;\n const leasedJob = requireLeasedJobContext(request);\n\n const {active: leaseIsActive} = await runners.getLeaseState({\n jobId: leasedJob.jobId,\n jobExecutionId: leasedJob.jobExecutionId,\n runnerSessionId: leasedJob.runnerSessionId,\n });\n if (!leaseIsActive) {\n throw new ClientError('Job lease is no longer active', 'lease-not-active', {status: 404});\n }\n\n const outcome = await recordStepResult({\n jobExecutionId: leasedJob.jobExecutionId,\n stepId,\n status: request.body.status,\n error: fromStepErrorDto(request.body.error),\n output: request.body.output ?? null,\n response: request.body.response ?? null,\n exitCode: request.body.exit_code ?? request.body.error?.exit_code ?? null,\n logOutcome: request.body.log_outcome,\n ...(request.body.attempt !== undefined ? {attempt: request.body.attempt} : {}),\n });\n\n return {ok: true, cancel: outcome.jobFinished && outcome.status === 'failed'};\n },\n });\n}\n"],"names":["requireLeasedJobContext","reportStepBodySchema","reportStepResponseSchema","ClientError","defineRoute","z","StepAttemptAheadError","StepNotFoundError","StepNotRunningError","recordStepResult","fromStepErrorDto","createReportStepRoute","runners","method","path","description","schema","params","object","stepId","string","uuid","body","response","errorHandler","error","message","status","handler","request","leasedJob","active","leaseIsActive","getLeaseState","jobId","jobExecutionId","runnerSessionId","outcome","output","exitCode","exit_code","logOutcome","log_outcome","attempt","undefined","ok","cancel","jobFinished"],"mappings":"AAAA,SAAQA,uBAAuB,QAAO,4BAA4B;AAElE,SAAQC,oBAAoB,EAAEC,wBAAwB,QAAO,6BAA6B;AAC1F,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,CAAC,QAAO,MAAM;AACtB,SAAQC,qBAAqB,EAAEC,iBAAiB,EAAEC,mBAAmB,QAAO,kBAAkB;A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CAACG,KAAK;gBAC1Ca,QAAQT,QAAQP,IAAI,CAACgB,MAAM,IAAI;gBAC/Bf,UAAUM,QAAQP,IAAI,CAACC,QAAQ,IAAI;gBACnCgB,UAAUV,QAAQP,IAAI,CAACkB,SAAS,IAAIX,QAAQP,IAAI,CAACG,KAAK,EAAEe,aAAa;gBACrEC,YAAYZ,QAAQP,IAAI,CAACoB,WAAW;gBACpC,GAAIb,QAAQP,IAAI,CAACqB,OAAO,KAAKC,YAAY;oBAACD,SAASd,QAAQP,IAAI,CAACqB,OAAO;gBAAA,IAAI,CAAC,CAAC;YAC/E;YAEA,OAAO;gBAACE,IAAI;gBAAMC,QAAQT,QAAQU,WAAW,IAAIV,QAAQV,MAAM,KAAK;YAAQ;QAC9E;IACF;AACF"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto';
|
|
1
2
|
import type { FastifyRequest } from 'fastify';
|
|
2
3
|
import type { WorkflowRun } from '#core/entities/workflow-run.js';
|
|
3
|
-
export declare function requireAccessibleRun({ request, id, }: {
|
|
4
|
+
export declare function requireAccessibleRun({ request, id, projects, }: {
|
|
4
5
|
request: FastifyRequest;
|
|
5
6
|
id: string;
|
|
7
|
+
projects: ProjectsModuleClient;
|
|
6
8
|
}): Promise<WorkflowRun>;
|
|
7
9
|
//# sourceMappingURL=require-accessible-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-accessible-run.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/require-accessible-run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"require-accessible-run.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/require-accessible-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAEpE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAIhE,wBAAsB,oBAAoB,CAAC,EACzC,OAAO,EACP,EAAE,EACF,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,cAAc,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAAC,WAAW,CAAC,CAcvB"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { requireProjectAccess } from '@shipfox/api-projects';
|
|
2
1
|
import { ClientError } from '@shipfox/node-fastify';
|
|
3
2
|
import { getWorkflowRunById } from '#db/index.js';
|
|
4
|
-
|
|
3
|
+
import { requireProjectAccess } from './project-access.js';
|
|
4
|
+
export async function requireAccessibleRun({ request, id, projects }) {
|
|
5
5
|
const run = await getWorkflowRunById(id);
|
|
6
6
|
if (!run) {
|
|
7
7
|
throw new ClientError('Run not found', 'not-found', {
|
|
8
8
|
status: 404
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
await requireProjectAccess({
|
|
12
|
-
request,
|
|
13
|
-
projectId: run.projectId
|
|
14
|
-
}).catch((err)=>{
|
|
11
|
+
await requireProjectAccess(request, run.projectId, projects).catch((err)=>{
|
|
15
12
|
if (err instanceof ClientError && (err.status === 403 || err.status === 404)) {
|
|
16
13
|
throw new ClientError('Run not found', 'not-found', {
|
|
17
14
|
status: 404
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/routes/require-accessible-run.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/routes/require-accessible-run.ts"],"sourcesContent":["import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';\nimport {ClientError} from '@shipfox/node-fastify';\nimport type {FastifyRequest} from 'fastify';\nimport type {WorkflowRun} from '#core/entities/workflow-run.js';\nimport {getWorkflowRunById} from '#db/index.js';\nimport {requireProjectAccess} from './project-access.js';\n\nexport async function requireAccessibleRun({\n request,\n id,\n projects,\n}: {\n request: FastifyRequest;\n id: string;\n projects: ProjectsModuleClient;\n}): Promise<WorkflowRun> {\n const run = await getWorkflowRunById(id);\n if (!run) {\n throw new ClientError('Run not found', 'not-found', {status: 404});\n }\n\n await requireProjectAccess(request, run.projectId, projects).catch((err: unknown) => {\n if (err instanceof ClientError && (err.status === 403 || err.status === 404)) {\n throw new ClientError('Run not found', 'not-found', {status: 404});\n }\n throw err;\n });\n\n return run;\n}\n"],"names":["ClientError","getWorkflowRunById","requireProjectAccess","requireAccessibleRun","request","id","projects","run","status","projectId","catch","err"],"mappings":"AACA,SAAQA,WAAW,QAAO,wBAAwB;AAGlD,SAAQC,kBAAkB,QAAO,eAAe;AAChD,SAAQC,oBAAoB,QAAO,sBAAsB;AAEzD,OAAO,eAAeC,qBAAqB,EACzCC,OAAO,EACPC,EAAE,EACFC,QAAQ,EAKT;IACC,MAAMC,MAAM,MAAMN,mBAAmBI;IACrC,IAAI,CAACE,KAAK;QACR,MAAM,IAAIP,YAAY,iBAAiB,aAAa;YAACQ,QAAQ;QAAG;IAClE;IAEA,MAAMN,qBAAqBE,SAASG,IAAIE,SAAS,EAAEH,UAAUI,KAAK,CAAC,CAACC;QAClE,IAAIA,eAAeX,eAAgBW,CAAAA,IAAIH,MAAM,KAAK,OAAOG,IAAIH,MAAM,KAAK,GAAE,GAAI;YAC5E,MAAM,IAAIR,YAAY,iBAAiB,aAAa;gBAACQ,QAAQ;YAAG;QAClE;QACA,MAAMG;IACR;IAEA,OAAOJ;AACT"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto';
|
|
2
|
+
export declare function rerunRunRoute(projects: ProjectsModuleClient): import("@shipfox/node-fastify").RouteDefinition;
|
|
2
3
|
//# sourceMappingURL=rerun-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rerun-run.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/rerun-run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rerun-run.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/rerun-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AASpE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,oBAAoB,mDAwC3D"}
|
|
@@ -6,51 +6,54 @@ import { NoFailedJobsError, RunNotTerminalError, SourceRunNotFoundError } from '
|
|
|
6
6
|
import { createRerunWorkflowRun } from '#db/index.js';
|
|
7
7
|
import { toRunDto } from '#presentation/dto/index.js';
|
|
8
8
|
import { requireAccessibleRun } from './require-accessible-run.js';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
export function rerunRunRoute(projects) {
|
|
10
|
+
return defineRoute({
|
|
11
|
+
method: 'POST',
|
|
12
|
+
path: '/:id/rerun',
|
|
13
|
+
description: 'Re-run a terminal workflow run',
|
|
14
|
+
schema: {
|
|
15
|
+
params: z.object({
|
|
16
|
+
id: z.string().uuid()
|
|
17
|
+
}),
|
|
18
|
+
body: rerunWorkflowRunBodySchema,
|
|
19
|
+
response: {
|
|
20
|
+
200: workflowRunResponseSchema
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
errorHandler: (error)=>{
|
|
24
|
+
if (error instanceof SourceRunNotFoundError) {
|
|
25
|
+
throw new ClientError('Run not found', 'not-found', {
|
|
26
|
+
status: 404
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (error instanceof RunNotTerminalError) {
|
|
30
|
+
throw new ClientError('Run is not terminal', 'run-not-terminal', {
|
|
31
|
+
status: 409
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (error instanceof NoFailedJobsError) {
|
|
35
|
+
throw new ClientError('Run has no failed jobs', 'no-failed-jobs', {
|
|
36
|
+
status: 409
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
},
|
|
41
|
+
handler: async (request)=>{
|
|
42
|
+
const { id } = request.params;
|
|
43
|
+
const sourceRun = await requireAccessibleRun({
|
|
44
|
+
request,
|
|
45
|
+
id,
|
|
46
|
+
projects
|
|
31
47
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
const actor = requireUserContext(request);
|
|
49
|
+
const run = await createRerunWorkflowRun({
|
|
50
|
+
workflowRunId: sourceRun.id,
|
|
51
|
+
mode: request.body.mode,
|
|
52
|
+
actorUserId: actor.userId
|
|
36
53
|
});
|
|
54
|
+
return toRunDto(run, run.currentAttempt);
|
|
37
55
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
handler: async (request)=>{
|
|
41
|
-
const { id } = request.params;
|
|
42
|
-
const sourceRun = await requireAccessibleRun({
|
|
43
|
-
request,
|
|
44
|
-
id
|
|
45
|
-
});
|
|
46
|
-
const actor = requireUserContext(request);
|
|
47
|
-
const run = await createRerunWorkflowRun({
|
|
48
|
-
workflowRunId: sourceRun.id,
|
|
49
|
-
mode: request.body.mode,
|
|
50
|
-
actorUserId: actor.userId
|
|
51
|
-
});
|
|
52
|
-
return toRunDto(run, run.currentAttempt);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
55
58
|
|
|
56
59
|
//# sourceMappingURL=rerun-run.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/routes/rerun-run.ts"],"sourcesContent":["import {requireUserContext} from '@shipfox/api-auth-context';\nimport {rerunWorkflowRunBodySchema, workflowRunResponseSchema} from '@shipfox/api-workflows-dto';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {z} from 'zod';\nimport {NoFailedJobsError, RunNotTerminalError, SourceRunNotFoundError} from '#core/errors.js';\nimport {createRerunWorkflowRun} from '#db/index.js';\nimport {toRunDto} from '#presentation/dto/index.js';\nimport {requireAccessibleRun} from './require-accessible-run.js';\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/routes/rerun-run.ts"],"sourcesContent":["import {requireUserContext} from '@shipfox/api-auth-context';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto';\nimport {rerunWorkflowRunBodySchema, workflowRunResponseSchema} from '@shipfox/api-workflows-dto';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {z} from 'zod';\nimport {NoFailedJobsError, RunNotTerminalError, SourceRunNotFoundError} from '#core/errors.js';\nimport {createRerunWorkflowRun} from '#db/index.js';\nimport {toRunDto} from '#presentation/dto/index.js';\nimport {requireAccessibleRun} from './require-accessible-run.js';\n\nexport function rerunRunRoute(projects: ProjectsModuleClient) {\n return defineRoute({\n method: 'POST',\n path: '/:id/rerun',\n description: 'Re-run a terminal workflow run',\n schema: {\n params: z.object({\n id: z.string().uuid(),\n }),\n body: rerunWorkflowRunBodySchema,\n response: {\n 200: workflowRunResponseSchema,\n },\n },\n errorHandler: (error) => {\n if (error instanceof SourceRunNotFoundError) {\n throw new ClientError('Run not found', 'not-found', {status: 404});\n }\n if (error instanceof RunNotTerminalError) {\n throw new ClientError('Run is not terminal', 'run-not-terminal', {status: 409});\n }\n if (error instanceof NoFailedJobsError) {\n throw new ClientError('Run has no failed jobs', 'no-failed-jobs', {status: 409});\n }\n throw error;\n },\n handler: async (request) => {\n const {id} = request.params;\n const sourceRun = await requireAccessibleRun({request, id, projects});\n\n const actor = requireUserContext(request);\n const run = await createRerunWorkflowRun({\n workflowRunId: sourceRun.id,\n mode: request.body.mode,\n actorUserId: actor.userId,\n });\n\n return toRunDto(run, run.currentAttempt);\n },\n });\n}\n"],"names":["requireUserContext","rerunWorkflowRunBodySchema","workflowRunResponseSchema","ClientError","defineRoute","z","NoFailedJobsError","RunNotTerminalError","SourceRunNotFoundError","createRerunWorkflowRun","toRunDto","requireAccessibleRun","rerunRunRoute","projects","method","path","description","schema","params","object","id","string","uuid","body","response","errorHandler","error","status","handler","request","sourceRun","actor","run","workflowRunId","mode","actorUserId","userId","currentAttempt"],"mappings":"AAAA,SAAQA,kBAAkB,QAAO,4BAA4B;AAE7D,SAAQC,0BAA0B,EAAEC,yBAAyB,QAAO,6BAA6B;AACjG,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,CAAC,QAAO,MAAM;AACtB,SAAQC,iBAAiB,EAAEC,mBAAmB,EAAEC,sBAAsB,QAAO,kBAAkB;AAC/F,SAAQC,sBAAsB,QAAO,eAAe;AACpD,SAAQC,QAAQ,QAAO,6BAA6B;AACpD,SAAQC,oBAAoB,QAAO,8BAA8B;AAEjE,OAAO,SAASC,cAAcC,QAA8B;IAC1D,OAAOT,YAAY;QACjBU,QAAQ;QACRC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACNC,QAAQb,EAAEc,MAAM,CAAC;gBACfC,IAAIf,EAAEgB,MAAM,GAAGC,IAAI;YACrB;YACAC,MAAMtB;YACNuB,UAAU;gBACR,KAAKtB;YACP;QACF;QACAuB,cAAc,CAACC;YACb,IAAIA,iBAAiBlB,wBAAwB;gBAC3C,MAAM,IAAIL,YAAY,iBAAiB,aAAa;oBAACwB,QAAQ;gBAAG;YAClE;YACA,IAAID,iBAAiBnB,qBAAqB;gBACxC,MAAM,IAAIJ,YAAY,uBAAuB,oBAAoB;oBAACwB,QAAQ;gBAAG;YAC/E;YACA,IAAID,iBAAiBpB,mBAAmB;gBACtC,MAAM,IAAIH,YAAY,0BAA0B,kBAAkB;oBAACwB,QAAQ;gBAAG;YAChF;YACA,MAAMD;QACR;QACAE,SAAS,OAAOC;YACd,MAAM,EAACT,EAAE,EAAC,GAAGS,QAAQX,MAAM;YAC3B,MAAMY,YAAY,MAAMnB,qBAAqB;gBAACkB;gBAAST;gBAAIP;YAAQ;YAEnE,MAAMkB,QAAQ/B,mBAAmB6B;YACjC,MAAMG,MAAM,MAAMvB,uBAAuB;gBACvCwB,eAAeH,UAAUV,EAAE;gBAC3Bc,MAAML,QAAQN,IAAI,CAACW,IAAI;gBACvBC,aAAaJ,MAAMK,MAAM;YAC3B;YAEA,OAAO1B,SAASsB,KAAKA,IAAIK,cAAc;QACzC;IACF;AACF"}
|
|
@@ -1,23 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { AgentInterModuleClient } from '@shipfox/api-agent-dto/inter-module';
|
|
2
|
+
import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto';
|
|
3
|
+
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto';
|
|
4
|
+
import type { RunnersInterModuleClient } from '@shipfox/api-runners-dto/inter-module';
|
|
5
|
+
import type { SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
|
|
6
|
+
import { activateJobListenerActivity, bulkSetStepStatuses, evaluateJobActivationsActivity, failJobExecutionAsTimedOutActivity, failRunAsTimedOutActivity, loadRunAttemptDag, peekListenerBufferActivity, recordListenerFiringOutcomeActivity, resolveJobListenerActivity, resolveJobStatusFromJobExecutionsActivity, resolveLeaseExpiredJobExecutionActivity, setJobExecutionStatus, setJobStatus, setRunAttemptStatus, settleListenerJobExecutionActivity } from './orchestration-activities.js';
|
|
7
|
+
export declare function createOrchestrationActivities(params: {
|
|
8
|
+
agent: AgentInterModuleClient;
|
|
9
|
+
integrations: IntegrationsModuleClient;
|
|
10
|
+
projects: ProjectsModuleClient;
|
|
11
|
+
runners: RunnersInterModuleClient;
|
|
12
|
+
secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;
|
|
13
|
+
}): {
|
|
3
14
|
loadRunAttemptDag: typeof loadRunAttemptDag;
|
|
4
15
|
setRunAttemptStatus: typeof setRunAttemptStatus;
|
|
5
16
|
setJobStatus: typeof setJobStatus;
|
|
6
|
-
setJobExecutionStatus: typeof setJobExecutionStatus
|
|
17
|
+
setJobExecutionStatus: (activityParams: Parameters<typeof setJobExecutionStatus>[0]) => Promise<{
|
|
18
|
+
newVersion: number;
|
|
19
|
+
status: Exclude<import("../../core/index.js").JobStatus, "skipped">;
|
|
20
|
+
}>;
|
|
7
21
|
bulkSetStepStatuses: typeof bulkSetStepStatuses;
|
|
8
|
-
cancelRunnerJobsActivity:
|
|
9
|
-
|
|
22
|
+
cancelRunnerJobsActivity: (params: {
|
|
23
|
+
jobIds: string[];
|
|
24
|
+
}) => Promise<void>;
|
|
25
|
+
enqueueJobExecutionForRunner: (params: {
|
|
26
|
+
workspaceId: string;
|
|
27
|
+
workflowRunId: string;
|
|
28
|
+
jobId: string;
|
|
29
|
+
jobExecutionId: string;
|
|
30
|
+
runAttemptId: string;
|
|
31
|
+
projectId: string;
|
|
32
|
+
requiredLabels: string[];
|
|
33
|
+
}) => Promise<void>;
|
|
10
34
|
evaluateJobActivationsActivity: typeof evaluateJobActivationsActivity;
|
|
11
|
-
failJobExecutionAsTimedOutActivity: typeof failJobExecutionAsTimedOutActivity
|
|
35
|
+
failJobExecutionAsTimedOutActivity: (activityParams: Parameters<typeof failJobExecutionAsTimedOutActivity>[0]) => Promise<{
|
|
36
|
+
newVersion: number;
|
|
37
|
+
}>;
|
|
12
38
|
failRunAsTimedOutActivity: typeof failRunAsTimedOutActivity;
|
|
13
39
|
activateJobListenerActivity: typeof activateJobListenerActivity;
|
|
14
|
-
drainListenerEventsActivity:
|
|
40
|
+
drainListenerEventsActivity: (params: {
|
|
41
|
+
jobId: string;
|
|
42
|
+
expectedSequence: number;
|
|
43
|
+
maxSize?: number | undefined;
|
|
44
|
+
}) => Promise<import("../../db/job-listeners.js").DrainListenerEventsResult>;
|
|
15
45
|
peekListenerBufferActivity: typeof peekListenerBufferActivity;
|
|
16
46
|
resolveJobListenerActivity: typeof resolveJobListenerActivity;
|
|
17
47
|
settleListenerJobExecutionActivity: typeof settleListenerJobExecutionActivity;
|
|
18
48
|
recordListenerFiringOutcomeActivity: typeof recordListenerFiringOutcomeActivity;
|
|
19
|
-
resolveLeaseExpiredJobExecutionActivity: typeof resolveLeaseExpiredJobExecutionActivity
|
|
49
|
+
resolveLeaseExpiredJobExecutionActivity: (activityParams: Parameters<typeof resolveLeaseExpiredJobExecutionActivity>[0]) => Promise<{
|
|
50
|
+
status: import("../../core/workflow-scheduling/runtime-dag.js").RuntimeCompletionStatus;
|
|
51
|
+
executionVersion: number;
|
|
52
|
+
}>;
|
|
20
53
|
resolveJobStatusFromJobExecutionsActivity: typeof resolveJobStatusFromJobExecutionsActivity;
|
|
21
|
-
releaseLeaseActivity:
|
|
54
|
+
releaseLeaseActivity: (params: {
|
|
55
|
+
jobExecutionId: string;
|
|
56
|
+
}) => Promise<void>;
|
|
22
57
|
};
|
|
23
58
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EAKnB,8BAA8B,EAC9B,kCAAkC,EAClC,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,mCAAmC,EACnC,0BAA0B,EAC1B,yCAAyC,EACzC,uCAAuC,EACvC,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,kCAAkC,EACnC,MAAM,+BAA+B,CAAC;AAEvC,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;CACpE;;;;4CAKiD,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;yDAOvE,UAAU,CAAC,OAAO,kCAAkC,CAAC,CAAC,CAAC,CAAC;;;;;;;;eAoBgkP,CAAC;;;;;;8DANznP,UAAU,CAAC,OAAO,uCAAuC,CAAC,CAAC,CAAC,CAAC;;;;;;;;EAKlF"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { activateJobListenerActivity, bulkSetStepStatuses,
|
|
2
|
-
export function createOrchestrationActivities() {
|
|
1
|
+
import { activateJobListenerActivity, bulkSetStepStatuses, createCancelRunnerJobsActivity, createDrainListenerEventsActivity, createEnqueueJobExecutionForRunner, createReleaseLeaseActivity, evaluateJobActivationsActivity, failJobExecutionAsTimedOutActivity, failRunAsTimedOutActivity, loadRunAttemptDag, peekListenerBufferActivity, recordListenerFiringOutcomeActivity, resolveJobListenerActivity, resolveJobStatusFromJobExecutionsActivity, resolveLeaseExpiredJobExecutionActivity, setJobExecutionStatus, setJobStatus, setRunAttemptStatus, settleListenerJobExecutionActivity } from './orchestration-activities.js';
|
|
2
|
+
export function createOrchestrationActivities(params) {
|
|
3
3
|
return {
|
|
4
4
|
loadRunAttemptDag,
|
|
5
5
|
setRunAttemptStatus,
|
|
6
6
|
setJobStatus,
|
|
7
|
-
setJobExecutionStatus,
|
|
7
|
+
setJobExecutionStatus: async (activityParams)=>await setJobExecutionStatus(activityParams, params.secrets),
|
|
8
8
|
bulkSetStepStatuses,
|
|
9
|
-
cancelRunnerJobsActivity,
|
|
10
|
-
enqueueJobExecutionForRunner,
|
|
9
|
+
cancelRunnerJobsActivity: createCancelRunnerJobsActivity(params.runners),
|
|
10
|
+
enqueueJobExecutionForRunner: createEnqueueJobExecutionForRunner(params.runners),
|
|
11
11
|
evaluateJobActivationsActivity,
|
|
12
|
-
failJobExecutionAsTimedOutActivity,
|
|
12
|
+
failJobExecutionAsTimedOutActivity: async (activityParams)=>await failJobExecutionAsTimedOutActivity(activityParams, params.secrets),
|
|
13
13
|
failRunAsTimedOutActivity,
|
|
14
14
|
activateJobListenerActivity,
|
|
15
|
-
drainListenerEventsActivity
|
|
15
|
+
drainListenerEventsActivity: createDrainListenerEventsActivity({
|
|
16
|
+
agent: params.agent,
|
|
17
|
+
integrations: params.integrations,
|
|
18
|
+
projects: params.projects
|
|
19
|
+
}),
|
|
16
20
|
peekListenerBufferActivity,
|
|
17
21
|
resolveJobListenerActivity,
|
|
18
22
|
settleListenerJobExecutionActivity,
|
|
19
23
|
recordListenerFiringOutcomeActivity,
|
|
20
|
-
resolveLeaseExpiredJobExecutionActivity,
|
|
24
|
+
resolveLeaseExpiredJobExecutionActivity: async (activityParams)=>await resolveLeaseExpiredJobExecutionActivity(activityParams, params.secrets),
|
|
21
25
|
resolveJobStatusFromJobExecutionsActivity,
|
|
22
|
-
releaseLeaseActivity
|
|
26
|
+
releaseLeaseActivity: createReleaseLeaseActivity(params.runners)
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/temporal/activities/index.ts"],"sourcesContent":["import {\n activateJobListenerActivity,\n bulkSetStepStatuses,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/temporal/activities/index.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n activateJobListenerActivity,\n bulkSetStepStatuses,\n createCancelRunnerJobsActivity,\n createDrainListenerEventsActivity,\n createEnqueueJobExecutionForRunner,\n createReleaseLeaseActivity,\n evaluateJobActivationsActivity,\n failJobExecutionAsTimedOutActivity,\n failRunAsTimedOutActivity,\n loadRunAttemptDag,\n peekListenerBufferActivity,\n recordListenerFiringOutcomeActivity,\n resolveJobListenerActivity,\n resolveJobStatusFromJobExecutionsActivity,\n resolveLeaseExpiredJobExecutionActivity,\n setJobExecutionStatus,\n setJobStatus,\n setRunAttemptStatus,\n settleListenerJobExecutionActivity,\n} from './orchestration-activities.js';\n\nexport function createOrchestrationActivities(params: {\n agent: AgentInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;\n}) {\n return {\n loadRunAttemptDag,\n setRunAttemptStatus,\n setJobStatus,\n setJobExecutionStatus: async (activityParams: Parameters<typeof setJobExecutionStatus>[0]) =>\n await setJobExecutionStatus(activityParams, params.secrets),\n bulkSetStepStatuses,\n cancelRunnerJobsActivity: createCancelRunnerJobsActivity(params.runners),\n enqueueJobExecutionForRunner: createEnqueueJobExecutionForRunner(params.runners),\n evaluateJobActivationsActivity,\n failJobExecutionAsTimedOutActivity: async (\n activityParams: Parameters<typeof failJobExecutionAsTimedOutActivity>[0],\n ) => await failJobExecutionAsTimedOutActivity(activityParams, params.secrets),\n failRunAsTimedOutActivity,\n activateJobListenerActivity,\n drainListenerEventsActivity: createDrainListenerEventsActivity({\n agent: params.agent,\n integrations: params.integrations,\n projects: params.projects,\n }),\n peekListenerBufferActivity,\n resolveJobListenerActivity,\n settleListenerJobExecutionActivity,\n recordListenerFiringOutcomeActivity,\n resolveLeaseExpiredJobExecutionActivity: async (\n activityParams: Parameters<typeof resolveLeaseExpiredJobExecutionActivity>[0],\n ) => await resolveLeaseExpiredJobExecutionActivity(activityParams, params.secrets),\n resolveJobStatusFromJobExecutionsActivity,\n releaseLeaseActivity: createReleaseLeaseActivity(params.runners),\n };\n}\n"],"names":["activateJobListenerActivity","bulkSetStepStatuses","createCancelRunnerJobsActivity","createDrainListenerEventsActivity","createEnqueueJobExecutionForRunner","createReleaseLeaseActivity","evaluateJobActivationsActivity","failJobExecutionAsTimedOutActivity","failRunAsTimedOutActivity","loadRunAttemptDag","peekListenerBufferActivity","recordListenerFiringOutcomeActivity","resolveJobListenerActivity","resolveJobStatusFromJobExecutionsActivity","resolveLeaseExpiredJobExecutionActivity","setJobExecutionStatus","setJobStatus","setRunAttemptStatus","settleListenerJobExecutionActivity","createOrchestrationActivities","params","activityParams","secrets","cancelRunnerJobsActivity","runners","enqueueJobExecutionForRunner","drainListenerEventsActivity","agent","integrations","projects","releaseLeaseActivity"],"mappings":"AAKA,SACEA,2BAA2B,EAC3BC,mBAAmB,EACnBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,kCAAkC,EAClCC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,kCAAkC,EAClCC,yBAAyB,EACzBC,iBAAiB,EACjBC,0BAA0B,EAC1BC,mCAAmC,EACnCC,0BAA0B,EAC1BC,yCAAyC,EACzCC,uCAAuC,EACvCC,qBAAqB,EACrBC,YAAY,EACZC,mBAAmB,EACnBC,kCAAkC,QAC7B,gCAAgC;AAEvC,OAAO,SAASC,8BAA8BC,MAM7C;IACC,OAAO;QACLX;QACAQ;QACAD;QACAD,uBAAuB,OAAOM,iBAC5B,MAAMN,sBAAsBM,gBAAgBD,OAAOE,OAAO;QAC5DrB;QACAsB,0BAA0BrB,+BAA+BkB,OAAOI,OAAO;QACvEC,8BAA8BrB,mCAAmCgB,OAAOI,OAAO;QAC/ElB;QACAC,oCAAoC,OAClCc,iBACG,MAAMd,mCAAmCc,gBAAgBD,OAAOE,OAAO;QAC5Ed;QACAR;QACA0B,6BAA6BvB,kCAAkC;YAC7DwB,OAAOP,OAAOO,KAAK;YACnBC,cAAcR,OAAOQ,YAAY;YACjCC,UAAUT,OAAOS,QAAQ;QAC3B;QACAnB;QACAE;QACAM;QACAP;QACAG,yCAAyC,OACvCO,iBACG,MAAMP,wCAAwCO,gBAAgBD,OAAOE,OAAO;QACjFT;QACAiB,sBAAsBzB,2BAA2Be,OAAOI,OAAO;IACjE;AACF"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { AgentInterModuleClient } from '@shipfox/api-agent-dto/inter-module';
|
|
2
|
+
import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto';
|
|
3
|
+
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto';
|
|
4
|
+
import { type RunnersInterModuleClient } from '@shipfox/api-runners-dto/inter-module';
|
|
5
|
+
import type { SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
|
|
1
6
|
import type { JobStatus, JobStatusReason, ResolutionReason } from '#core/entities/job.js';
|
|
2
7
|
import type { PersistedEvaluationTraceEntry, StepStatus } from '#core/entities/step.js';
|
|
3
8
|
import type { WorkflowRunStatus } from '#core/entities/workflow-run.js';
|
|
@@ -55,7 +60,7 @@ export declare function setJobExecutionStatus(params: {
|
|
|
55
60
|
status: Exclude<JobStatus, 'skipped'>;
|
|
56
61
|
version: number;
|
|
57
62
|
statusReason?: JobStatusReason | null | undefined;
|
|
58
|
-
}): Promise<{
|
|
63
|
+
}, secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>): Promise<{
|
|
59
64
|
newVersion: number;
|
|
60
65
|
status: Exclude<JobStatus, 'skipped'>;
|
|
61
66
|
}>;
|
|
@@ -66,14 +71,14 @@ export declare function bulkSetStepStatuses(params: {
|
|
|
66
71
|
export declare function resolveLeaseExpiredJobExecutionActivity(params: {
|
|
67
72
|
jobExecutionId: string;
|
|
68
73
|
expectedVersion: number;
|
|
69
|
-
}): Promise<{
|
|
74
|
+
}, secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>): Promise<{
|
|
70
75
|
status: RuntimeCompletionStatus;
|
|
71
76
|
executionVersion: number;
|
|
72
77
|
}>;
|
|
73
|
-
export declare function
|
|
78
|
+
export declare function createReleaseLeaseActivity(runners: RunnersInterModuleClient): (params: {
|
|
74
79
|
jobExecutionId: string;
|
|
75
|
-
})
|
|
76
|
-
export declare function
|
|
80
|
+
}) => Promise<void>;
|
|
81
|
+
export declare function createEnqueueJobExecutionForRunner(runners: RunnersInterModuleClient): (params: {
|
|
77
82
|
workspaceId: string;
|
|
78
83
|
workflowRunId: string;
|
|
79
84
|
jobId: string;
|
|
@@ -81,15 +86,15 @@ export declare function enqueueJobExecutionForRunner(params: {
|
|
|
81
86
|
runAttemptId: string;
|
|
82
87
|
projectId: string;
|
|
83
88
|
requiredLabels: string[];
|
|
84
|
-
})
|
|
85
|
-
export declare function
|
|
89
|
+
}) => Promise<void>;
|
|
90
|
+
export declare function createCancelRunnerJobsActivity(runners: RunnersInterModuleClient): (params: {
|
|
86
91
|
jobIds: string[];
|
|
87
|
-
})
|
|
92
|
+
}) => Promise<void>;
|
|
88
93
|
export declare function failJobExecutionAsTimedOutActivity(params: {
|
|
89
94
|
jobExecutionId: string;
|
|
90
95
|
runAttemptId: string;
|
|
91
96
|
expectedVersion: number;
|
|
92
|
-
}): Promise<{
|
|
97
|
+
}, secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>): Promise<{
|
|
93
98
|
newVersion: number;
|
|
94
99
|
}>;
|
|
95
100
|
export declare function failRunAsTimedOutActivity(params: {
|
|
@@ -105,11 +110,15 @@ export declare function activateJobListenerActivity(params: {
|
|
|
105
110
|
jobId: string;
|
|
106
111
|
expectedVersion: number;
|
|
107
112
|
}): Promise<import("#db/index.js").ActivateJobListenerResult>;
|
|
108
|
-
export declare function
|
|
113
|
+
export declare function createDrainListenerEventsActivity(clients: {
|
|
114
|
+
agent: AgentInterModuleClient;
|
|
115
|
+
integrations?: IntegrationsModuleClient | undefined;
|
|
116
|
+
projects?: ProjectsModuleClient | undefined;
|
|
117
|
+
}): (params: {
|
|
109
118
|
jobId: string;
|
|
110
119
|
expectedSequence: number;
|
|
111
120
|
maxSize?: number | undefined;
|
|
112
|
-
})
|
|
121
|
+
}) => Promise<import("#db/index.js").DrainListenerEventsResult>;
|
|
113
122
|
export declare function peekListenerBufferActivity(params: {
|
|
114
123
|
jobId: string;
|
|
115
124
|
}): Promise<import("#db/index.js").ListenerBufferPeek>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-activities.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/orchestration-activities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"orchestration-activities.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/orchestration-activities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAIpF,OAAO,KAAK,EAAC,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACxF,OAAO,KAAK,EAAC,6BAA6B,EAAE,UAAU,EAAC,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAEtE,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACf,MAAM,0CAA0C,CAAC;AAClD,OAAO,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ter-module';
|
|
2
|
+
import { isInterModuleKnownError } from '@shipfox/inter-module';
|
|
2
3
|
import { ApplicationFailure } from '@temporalio/common';
|
|
3
4
|
import { defaultJobConditionTrace } from '#core/condition-trace.js';
|
|
4
5
|
import { JobNotFoundError } from '#core/errors.js';
|
|
@@ -85,12 +86,13 @@ function jobStatusEvaluationTrace(params) {
|
|
|
85
86
|
if (params.evaluationTrace !== undefined) return params.evaluationTrace;
|
|
86
87
|
return params.status === 'skipped' && params.statusReason === 'default_gate_rejected' ? defaultJobConditionTrace() : undefined;
|
|
87
88
|
}
|
|
88
|
-
export async function setJobExecutionStatus(params) {
|
|
89
|
+
export async function setJobExecutionStatus(params, secrets) {
|
|
89
90
|
const updated = await updateJobExecutionStatus({
|
|
90
91
|
jobExecutionId: params.jobExecutionId,
|
|
91
92
|
status: params.status,
|
|
92
93
|
expectedVersion: params.version,
|
|
93
|
-
statusReason: params.statusReason
|
|
94
|
+
statusReason: params.statusReason,
|
|
95
|
+
secrets
|
|
94
96
|
});
|
|
95
97
|
return {
|
|
96
98
|
newVersion: updated.version,
|
|
@@ -100,9 +102,12 @@ export async function setJobExecutionStatus(params) {
|
|
|
100
102
|
export async function bulkSetStepStatuses(params) {
|
|
101
103
|
await bulkUpdateStepStatuses(params);
|
|
102
104
|
}
|
|
103
|
-
export async function resolveLeaseExpiredJobExecutionActivity(params) {
|
|
105
|
+
export async function resolveLeaseExpiredJobExecutionActivity(params, secrets) {
|
|
104
106
|
try {
|
|
105
|
-
return await resolveJobExecutionAfterLeaseExpiry(
|
|
107
|
+
return await resolveJobExecutionAfterLeaseExpiry({
|
|
108
|
+
...params,
|
|
109
|
+
secrets
|
|
110
|
+
});
|
|
106
111
|
} catch (err) {
|
|
107
112
|
if (err instanceof JobNotFoundError) {
|
|
108
113
|
throw ApplicationFailure.nonRetryable(err.message, err.name);
|
|
@@ -113,39 +118,44 @@ export async function resolveLeaseExpiredJobExecutionActivity(params) {
|
|
|
113
118
|
// Best-effort lease cleanup on job finalization. Idempotent: deleting an
|
|
114
119
|
// already-released (or already-reaped) lease is a no-op. The workflow wraps the
|
|
115
120
|
// call so a persistent failure never blocks the DAG result.
|
|
116
|
-
export
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
export async function enqueueJobExecutionForRunner(params) {
|
|
122
|
-
try {
|
|
123
|
-
await enqueueJobExecution({
|
|
124
|
-
workspaceId: params.workspaceId,
|
|
125
|
-
workflowRunId: params.workflowRunId,
|
|
126
|
-
workflowRunAttemptId: params.runAttemptId,
|
|
127
|
-
jobId: params.jobId,
|
|
128
|
-
jobExecutionId: params.jobExecutionId,
|
|
129
|
-
projectId: params.projectId,
|
|
130
|
-
requiredLabels: params.requiredLabels
|
|
121
|
+
export function createReleaseLeaseActivity(runners) {
|
|
122
|
+
return async function releaseLeaseActivity(params) {
|
|
123
|
+
await runners.releaseJobExecution({
|
|
124
|
+
jobExecutionId: params.jobExecutionId
|
|
131
125
|
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export function createEnqueueJobExecutionForRunner(runners) {
|
|
129
|
+
return async function enqueueJobExecutionForRunner(params) {
|
|
130
|
+
try {
|
|
131
|
+
await runners.enqueueJobExecution({
|
|
132
|
+
workspaceId: params.workspaceId,
|
|
133
|
+
workflowRunId: params.workflowRunId,
|
|
134
|
+
workflowRunAttemptId: params.runAttemptId,
|
|
135
|
+
jobId: params.jobId,
|
|
136
|
+
jobExecutionId: params.jobExecutionId,
|
|
137
|
+
projectId: params.projectId,
|
|
138
|
+
requiredLabels: params.requiredLabels
|
|
139
|
+
});
|
|
140
|
+
} catch (err) {
|
|
141
|
+
if (isInterModuleKnownError(runnersInterModuleContract.methods.enqueueJobExecution, err)) {
|
|
142
|
+
throw ApplicationFailure.nonRetryable(err.message, err.name);
|
|
143
|
+
}
|
|
144
|
+
throw err;
|
|
135
145
|
}
|
|
136
|
-
|
|
137
|
-
}
|
|
146
|
+
};
|
|
138
147
|
}
|
|
139
|
-
export
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
148
|
+
export function createCancelRunnerJobsActivity(runners) {
|
|
149
|
+
return async function cancelRunnerJobsActivity(params) {
|
|
150
|
+
await runners.cancelJobs(params);
|
|
151
|
+
};
|
|
143
152
|
}
|
|
144
|
-
export async function failJobExecutionAsTimedOutActivity(params) {
|
|
153
|
+
export async function failJobExecutionAsTimedOutActivity(params, secrets) {
|
|
145
154
|
const jobExecution = await failJobExecutionAsTimedOut({
|
|
146
155
|
jobExecutionId: params.jobExecutionId,
|
|
147
156
|
workflowRunAttemptId: params.runAttemptId,
|
|
148
|
-
expectedVersion: params.expectedVersion
|
|
157
|
+
expectedVersion: params.expectedVersion,
|
|
158
|
+
secrets
|
|
149
159
|
});
|
|
150
160
|
return {
|
|
151
161
|
newVersion: jobExecution.version
|
|
@@ -162,8 +172,13 @@ export async function resolveJobStatusFromJobExecutionsActivity(params) {
|
|
|
162
172
|
export async function activateJobListenerActivity(params) {
|
|
163
173
|
return await activateJobListener(params);
|
|
164
174
|
}
|
|
165
|
-
export
|
|
166
|
-
return
|
|
175
|
+
export function createDrainListenerEventsActivity(clients) {
|
|
176
|
+
return async function drainListenerEventsActivity(params) {
|
|
177
|
+
return await drainListenerEventsIntoExecution({
|
|
178
|
+
...params,
|
|
179
|
+
...clients
|
|
180
|
+
});
|
|
181
|
+
};
|
|
167
182
|
}
|
|
168
183
|
export async function peekListenerBufferActivity(params) {
|
|
169
184
|
return await peekListenerBuffer(params);
|