@shipfox/api-workflows 12.7.0 → 13.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 +24 -0
- package/dist/core/errors.d.ts +9 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +5 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/job-execution.d.ts.map +1 -1
- package/dist/core/job-execution.js +12 -2
- package/dist/core/job-execution.js.map +1 -1
- package/dist/core/step-config/agent.d.ts.map +1 -1
- package/dist/core/step-config/agent.js +9 -1
- package/dist/core/step-config/agent.js.map +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/job-listeners.d.ts.map +1 -1
- package/dist/db/job-listeners.js +17 -1
- package/dist/db/job-listeners.js.map +1 -1
- package/dist/db/workflow-runs/job-executions.d.ts +2 -3
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
- package/dist/db/workflow-runs/job-executions.js +48 -20
- package/dist/db/workflow-runs/job-executions.js.map +1 -1
- package/dist/db/workflow-runs/outbox.d.ts +15 -0
- package/dist/db/workflow-runs/outbox.d.ts.map +1 -1
- package/dist/db/workflow-runs/outbox.js +35 -1
- package/dist/db/workflow-runs/outbox.js.map +1 -1
- package/dist/db/workflow-runs/run-graph.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-graph.js +12 -0
- package/dist/db/workflow-runs/run-graph.js.map +1 -1
- package/dist/db/workflow-runs/run-status.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-status.js +13 -1
- package/dist/db/workflow-runs/run-status.js.map +1 -1
- package/dist/db/workflow-runs.d.ts +2 -2
- package/dist/db/workflow-runs.d.ts.map +1 -1
- package/dist/db/workflow-runs.js +2 -2
- package/dist/db/workflow-runs.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/presentation/dto/step.d.ts.map +1 -1
- package/dist/presentation/dto/step.js +14 -0
- package/dist/presentation/dto/step.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/routes/agent-runtime-config.d.ts.map +1 -1
- package/dist/presentation/routes/agent-runtime-config.js +22 -0
- package/dist/presentation/routes/agent-runtime-config.js.map +1 -1
- package/dist/presentation/subscribers/index.d.ts +0 -1
- package/dist/presentation/subscribers/index.d.ts.map +1 -1
- package/dist/presentation/subscribers/index.js +0 -1
- package/dist/presentation/subscribers/index.js.map +1 -1
- package/dist/temporal/activities/index.d.ts +2 -18
- package/dist/temporal/activities/index.d.ts.map +1 -1
- package/dist/temporal/activities/index.js +3 -5
- package/dist/temporal/activities/index.js.map +1 -1
- package/dist/temporal/activities/orchestration-activities.d.ts +5 -14
- package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
- package/dist/temporal/activities/orchestration-activities.js +13 -34
- package/dist/temporal/activities/orchestration-activities.js.map +1 -1
- package/dist/temporal/workflows/index.bundle.js +20 -68
- package/dist/temporal/workflows/job-execution-orchestration.d.ts +0 -3
- package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -1
- package/dist/temporal/workflows/job-execution-orchestration.js +17 -41
- package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -1
- package/dist/temporal/workflows/job-listener-orchestration.d.ts +0 -3
- package/dist/temporal/workflows/job-listener-orchestration.d.ts.map +1 -1
- package/dist/temporal/workflows/job-listener-orchestration.js +1 -9
- package/dist/temporal/workflows/job-listener-orchestration.js.map +1 -1
- package/dist/temporal/workflows/run-orchestration.d.ts.map +1 -1
- package/dist/temporal/workflows/run-orchestration.js +2 -18
- package/dist/temporal/workflows/run-orchestration.js.map +1 -1
- package/dist/temporal/workflows/test-env.d.ts +4 -6
- package/dist/temporal/workflows/test-env.d.ts.map +1 -1
- package/dist/temporal/workflows/test-env.js +13 -24
- package/dist/temporal/workflows/test-env.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/core/errors.ts +17 -2
- package/src/core/job-execution.test.ts +54 -0
- package/src/core/job-execution.ts +6 -1
- package/src/core/step-config/agent.ts +8 -1
- package/src/core/step-config/complete-step-dispatch-config.test.ts +37 -0
- package/src/db/index.ts +1 -1
- package/src/db/job-listeners.test.ts +21 -0
- package/src/db/job-listeners.ts +18 -0
- package/src/db/workflow-runs/job-executions.test.ts +110 -12
- package/src/db/workflow-runs/job-executions.ts +54 -29
- package/src/db/workflow-runs/outbox.ts +63 -0
- package/src/db/workflow-runs/run-graph.ts +17 -0
- package/src/db/workflow-runs/run-status.test.ts +13 -0
- package/src/db/workflow-runs/run-status.ts +15 -1
- package/src/db/workflow-runs.ts +3 -1
- package/src/index.ts +1 -5
- package/src/presentation/dto/step.test.ts +8 -0
- package/src/presentation/dto/step.ts +9 -0
- package/src/presentation/index.ts +0 -1
- package/src/presentation/routes/agent-runtime-config.test.ts +84 -2
- package/src/presentation/routes/agent-runtime-config.ts +24 -0
- package/src/presentation/subscribers/index.ts +0 -1
- package/src/temporal/activities/index.ts +2 -8
- package/src/temporal/activities/orchestration-activities.test.ts +17 -1
- package/src/temporal/activities/orchestration-activities.ts +13 -46
- package/src/temporal/workflows/job-execution-orchestration.test.ts +6 -25
- package/src/temporal/workflows/job-execution-orchestration.ts +17 -43
- package/src/temporal/workflows/job-listener-orchestration-continuation.test.ts +0 -3
- package/src/temporal/workflows/job-listener-orchestration.test.ts +9 -12
- package/src/temporal/workflows/job-listener-orchestration.ts +0 -8
- package/src/temporal/workflows/run-orchestration.test.ts +22 -33
- package/src/temporal/workflows/run-orchestration.ts +4 -28
- package/src/temporal/workflows/test-env.ts +14 -34
- package/test/fixtures/runners-inter-module.ts +0 -3
- package/test/helpers/workflow-runs.ts +25 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/presentation/subscribers/on-runner-job-queued.d.ts +0 -3
- package/dist/presentation/subscribers/on-runner-job-queued.d.ts.map +0 -1
- package/dist/presentation/subscribers/on-runner-job-queued.js +0 -20
- package/dist/presentation/subscribers/on-runner-job-queued.js.map +0 -1
- package/src/presentation/subscribers/on-runner-job-queued.test.ts +0 -57
- package/src/presentation/subscribers/on-runner-job-queued.ts +0 -23
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"on-runner-job-queued.d.ts","sourceRoot":"","sources":["../../../src/presentation/subscribers/on-runner-job-queued.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAQnE,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcpF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { logger } from '@shipfox/node-opentelemetry';
|
|
2
|
-
import { recordJobExecutionQueuedAt } from '#db/index.js';
|
|
3
|
-
// Anticorruption layer for the runner's `queued` fact. Here the two contexts happen to
|
|
4
|
-
// share the word, so this is an identity mapping (unlike claimed → started_at). Use the
|
|
5
|
-
// runner-owned queue timestamp, not subscriber time; the DB projection is first-write-wins
|
|
6
|
-
// so outbox replay cannot move the queue boundary.
|
|
7
|
-
export async function onRunnerJobQueued(payload) {
|
|
8
|
-
logger().debug({
|
|
9
|
-
workflowRunId: payload.workflowRunId,
|
|
10
|
-
workflowRunAttemptId: payload.workflowRunAttemptId,
|
|
11
|
-
jobId: payload.jobId,
|
|
12
|
-
jobExecutionId: payload.jobExecutionId
|
|
13
|
-
}, 'Recording job execution queued_at');
|
|
14
|
-
await recordJobExecutionQueuedAt({
|
|
15
|
-
jobExecutionId: payload.jobExecutionId,
|
|
16
|
-
queuedAt: new Date(payload.queuedAt)
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=on-runner-job-queued.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/subscribers/on-runner-job-queued.ts"],"sourcesContent":["import type {RunnerJobQueuedEvent} from '@shipfox/api-runners-dto';\nimport {logger} from '@shipfox/node-opentelemetry';\nimport {recordJobExecutionQueuedAt} from '#db/index.js';\n\n// Anticorruption layer for the runner's `queued` fact. Here the two contexts happen to\n// share the word, so this is an identity mapping (unlike claimed → started_at). Use the\n// runner-owned queue timestamp, not subscriber time; the DB projection is first-write-wins\n// so outbox replay cannot move the queue boundary.\nexport async function onRunnerJobQueued(payload: RunnerJobQueuedEvent): Promise<void> {\n logger().debug(\n {\n workflowRunId: payload.workflowRunId,\n workflowRunAttemptId: payload.workflowRunAttemptId,\n jobId: payload.jobId,\n jobExecutionId: payload.jobExecutionId,\n },\n 'Recording job execution queued_at',\n );\n await recordJobExecutionQueuedAt({\n jobExecutionId: payload.jobExecutionId,\n queuedAt: new Date(payload.queuedAt),\n });\n}\n"],"names":["logger","recordJobExecutionQueuedAt","onRunnerJobQueued","payload","debug","workflowRunId","workflowRunAttemptId","jobId","jobExecutionId","queuedAt","Date"],"mappings":"AACA,SAAQA,MAAM,QAAO,8BAA8B;AACnD,SAAQC,0BAA0B,QAAO,eAAe;AAExD,uFAAuF;AACvF,wFAAwF;AACxF,2FAA2F;AAC3F,mDAAmD;AACnD,OAAO,eAAeC,kBAAkBC,OAA6B;IACnEH,SAASI,KAAK,CACZ;QACEC,eAAeF,QAAQE,aAAa;QACpCC,sBAAsBH,QAAQG,oBAAoB;QAClDC,OAAOJ,QAAQI,KAAK;QACpBC,gBAAgBL,QAAQK,cAAc;IACxC,GACA;IAEF,MAAMP,2BAA2B;QAC/BO,gBAAgBL,QAAQK,cAAc;QACtCC,UAAU,IAAIC,KAAKP,QAAQM,QAAQ;IACrC;AACF"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {getJobExecutionsByJobId, getJobsByWorkflowRunId} from '#db/index.js';
|
|
2
|
-
import {workflowRunFactory} from '#test/index.js';
|
|
3
|
-
import {onRunnerJobQueued} from './on-runner-job-queued.js';
|
|
4
|
-
|
|
5
|
-
describe('onRunnerJobQueued', () => {
|
|
6
|
-
it('stamps queued_at on the job execution from the event payload', async () => {
|
|
7
|
-
const run = await workflowRunFactory.create();
|
|
8
|
-
const job = (await getJobsByWorkflowRunId(run.id))[0];
|
|
9
|
-
expect(job).toBeDefined();
|
|
10
|
-
if (!job) return;
|
|
11
|
-
const jobExecution = (await getJobExecutionsByJobId(job.id))[0];
|
|
12
|
-
expect(jobExecution).toBeDefined();
|
|
13
|
-
if (!jobExecution) return;
|
|
14
|
-
const queuedAt = new Date('2026-06-22T10:00:00.000Z');
|
|
15
|
-
|
|
16
|
-
await onRunnerJobQueued({
|
|
17
|
-
workflowRunId: run.id,
|
|
18
|
-
workflowRunAttemptId: job.workflowRunAttemptId,
|
|
19
|
-
jobId: job.id,
|
|
20
|
-
jobExecutionId: jobExecution.id,
|
|
21
|
-
queuedAt: queuedAt.toISOString(),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const after = (await getJobExecutionsByJobId(job.id))[0];
|
|
25
|
-
expect(after?.queuedAt?.getTime()).toBe(queuedAt.getTime());
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('is idempotent: a redelivered event keeps the first queued_at (coalesce)', async () => {
|
|
29
|
-
const run = await workflowRunFactory.create();
|
|
30
|
-
const job = (await getJobsByWorkflowRunId(run.id))[0];
|
|
31
|
-
expect(job).toBeDefined();
|
|
32
|
-
if (!job) return;
|
|
33
|
-
const jobExecution = (await getJobExecutionsByJobId(job.id))[0];
|
|
34
|
-
expect(jobExecution).toBeDefined();
|
|
35
|
-
if (!jobExecution) return;
|
|
36
|
-
const first = new Date('2026-06-22T10:00:00.000Z');
|
|
37
|
-
const second = new Date('2026-06-22T11:00:00.000Z');
|
|
38
|
-
|
|
39
|
-
await onRunnerJobQueued({
|
|
40
|
-
workflowRunId: run.id,
|
|
41
|
-
workflowRunAttemptId: job.workflowRunAttemptId,
|
|
42
|
-
jobId: job.id,
|
|
43
|
-
jobExecutionId: jobExecution.id,
|
|
44
|
-
queuedAt: first.toISOString(),
|
|
45
|
-
});
|
|
46
|
-
await onRunnerJobQueued({
|
|
47
|
-
workflowRunId: run.id,
|
|
48
|
-
workflowRunAttemptId: job.workflowRunAttemptId,
|
|
49
|
-
jobId: job.id,
|
|
50
|
-
jobExecutionId: jobExecution.id,
|
|
51
|
-
queuedAt: second.toISOString(),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const after = (await getJobExecutionsByJobId(job.id))[0];
|
|
55
|
-
expect(after?.queuedAt?.getTime()).toBe(first.getTime());
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type {RunnerJobQueuedEvent} from '@shipfox/api-runners-dto';
|
|
2
|
-
import {logger} from '@shipfox/node-opentelemetry';
|
|
3
|
-
import {recordJobExecutionQueuedAt} from '#db/index.js';
|
|
4
|
-
|
|
5
|
-
// Anticorruption layer for the runner's `queued` fact. Here the two contexts happen to
|
|
6
|
-
// share the word, so this is an identity mapping (unlike claimed → started_at). Use the
|
|
7
|
-
// runner-owned queue timestamp, not subscriber time; the DB projection is first-write-wins
|
|
8
|
-
// so outbox replay cannot move the queue boundary.
|
|
9
|
-
export async function onRunnerJobQueued(payload: RunnerJobQueuedEvent): Promise<void> {
|
|
10
|
-
logger().debug(
|
|
11
|
-
{
|
|
12
|
-
workflowRunId: payload.workflowRunId,
|
|
13
|
-
workflowRunAttemptId: payload.workflowRunAttemptId,
|
|
14
|
-
jobId: payload.jobId,
|
|
15
|
-
jobExecutionId: payload.jobExecutionId,
|
|
16
|
-
},
|
|
17
|
-
'Recording job execution queued_at',
|
|
18
|
-
);
|
|
19
|
-
await recordJobExecutionQueuedAt({
|
|
20
|
-
jobExecutionId: payload.jobExecutionId,
|
|
21
|
-
queuedAt: new Date(payload.queuedAt),
|
|
22
|
-
});
|
|
23
|
-
}
|