@shipfox/api-workflows 12.2.0 → 12.3.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 +16 -0
- package/README.md +20 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +56 -0
- package/dist/config.js.map +1 -0
- package/dist/core/errors.d.ts +2 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +3 -2
- package/dist/core/errors.js.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.js +6 -4
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- 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/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +4 -0
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/db/workflow-runs/outbox.d.ts +1 -0
- package/dist/db/workflow-runs/outbox.d.ts.map +1 -1
- package/dist/db/workflow-runs/outbox.js +1 -0
- package/dist/db/workflow-runs/outbox.js.map +1 -1
- package/dist/db/workflow-runs/steps.d.ts +28 -0
- package/dist/db/workflow-runs/steps.d.ts.map +1 -1
- package/dist/db/workflow-runs/steps.js +49 -1
- package/dist/db/workflow-runs/steps.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 +1 -1
- package/dist/db/workflow-runs.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.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 +8 -0
- package/dist/metrics/instance.js.map +1 -1
- package/dist/presentation/dto/evaluation-trace.d.ts +4 -0
- package/dist/presentation/dto/evaluation-trace.d.ts.map +1 -0
- package/dist/presentation/dto/evaluation-trace.js +39 -0
- package/dist/presentation/dto/evaluation-trace.js.map +1 -0
- package/dist/presentation/dto/index.d.ts +2 -1
- package/dist/presentation/dto/index.d.ts.map +1 -1
- package/dist/presentation/dto/index.js +2 -1
- package/dist/presentation/dto/index.js.map +1 -1
- package/dist/presentation/dto/job.d.ts.map +1 -1
- package/dist/presentation/dto/job.js +6 -0
- package/dist/presentation/dto/job.js.map +1 -1
- package/dist/presentation/dto/step.d.ts +2 -1
- package/dist/presentation/dto/step.d.ts.map +1 -1
- package/dist/presentation/dto/step.js +12 -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/get-step-attempt-detail.d.ts +3 -0
- package/dist/presentation/routes/get-step-attempt-detail.d.ts.map +1 -0
- package/dist/presentation/routes/get-step-attempt-detail.js +38 -0
- package/dist/presentation/routes/get-step-attempt-detail.js.map +1 -0
- package/dist/presentation/routes/index.d.ts.map +1 -1
- package/dist/presentation/routes/index.js +2 -0
- package/dist/presentation/routes/index.js.map +1 -1
- package/dist/presentation/subscribers/index.d.ts +1 -0
- package/dist/presentation/subscribers/index.d.ts.map +1 -1
- package/dist/presentation/subscribers/index.js +1 -0
- package/dist/presentation/subscribers/index.js.map +1 -1
- package/dist/presentation/subscribers/on-failure-annotations.d.ts +5 -0
- package/dist/presentation/subscribers/on-failure-annotations.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-failure-annotations.js +160 -0
- package/dist/presentation/subscribers/on-failure-annotations.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +10 -8
- package/src/config.test.ts +85 -0
- package/src/config.ts +71 -0
- package/src/core/errors.ts +9 -2
- package/src/core/job-execution.test.ts +1 -0
- package/src/core/step-config/materialize-workflow-model.catalog.test.ts +117 -0
- package/src/core/step-config/materialize-workflow-model.ts +5 -3
- package/src/db/index.ts +4 -0
- package/src/db/workflow-runs/job-status.test.ts +10 -3
- package/src/db/workflow-runs/jobs.ts +7 -0
- package/src/db/workflow-runs/outbox.ts +7 -1
- package/src/db/workflow-runs/steps.test.ts +148 -0
- package/src/db/workflow-runs/steps.ts +105 -1
- package/src/db/workflow-runs.ts +4 -0
- package/src/index.ts +9 -0
- package/src/metrics/instance.ts +10 -0
- package/src/presentation/dto/evaluation-trace.ts +27 -0
- package/src/presentation/dto/index.ts +2 -1
- package/src/presentation/dto/job.ts +6 -0
- package/src/presentation/dto/step.test.ts +96 -1
- package/src/presentation/dto/step.ts +17 -0
- package/src/presentation/index.ts +2 -0
- package/src/presentation/routes/get-step-attempt-detail.test.ts +159 -0
- package/src/presentation/routes/get-step-attempt-detail.ts +33 -0
- package/src/presentation/routes/index.ts +2 -0
- package/src/presentation/subscribers/index.ts +4 -0
- package/src/presentation/subscribers/on-failure-annotations.test.ts +510 -0
- package/src/presentation/subscribers/on-failure-annotations.ts +237 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { dirname, resolve } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { RUNNER_JOB_CLAIMED, RUNNER_JOB_LEASE_EXPIRED, RUNNER_JOB_QUEUED } from '@shipfox/api-runners-dto';
|
|
4
|
-
import { WORKFLOWS_JOB_EVENT_DELIVERED, WORKFLOWS_JOB_STEPS_SETTLED, WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, WORKFLOWS_WORKFLOW_RUN_CANCELLED, workflowsEventSchemas } from '@shipfox/api-workflows-dto';
|
|
4
|
+
import { WORKFLOWS_JOB_EVENT_DELIVERED, WORKFLOWS_JOB_STEPS_SETTLED, WORKFLOWS_JOB_TERMINATED, WORKFLOWS_STEP_ATTEMPT_TERMINATED, WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, WORKFLOWS_WORKFLOW_RUN_CANCELLED, workflowsEventSchemas } from '@shipfox/api-workflows-dto';
|
|
5
5
|
import { subscriberFactory } from '@shipfox/node-module';
|
|
6
6
|
import { db, migrationsPath, workflowsOutbox } from '#db/index.js';
|
|
7
7
|
import { registerWorkflowsServiceMetrics } from '#metrics/index.js';
|
|
8
|
-
import { createWorkflowRoutes, onJobEventDelivered, onJobStepsSettled, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from '#presentation/index.js';
|
|
8
|
+
import { createWorkflowRoutes, onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from '#presentation/index.js';
|
|
9
9
|
import { createWorkflowsInterModulePresentation } from '#presentation/inter-module.js';
|
|
10
10
|
import { createOrchestrationActivities, WORKFLOWS_TASK_QUEUE } from '#temporal/index.js';
|
|
11
11
|
export { DefinitionNotFoundError, InterpolationUnresolvableError, isPermanentRunWorkflowError, ProjectMismatchError, runWorkflow, WorkflowRunNotCancellableError } from '#core/index.js';
|
|
@@ -46,6 +46,8 @@ export function createWorkflowsModule({ agent, definitions, annotations, auth, i
|
|
|
46
46
|
subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),
|
|
47
47
|
subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),
|
|
48
48
|
subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),
|
|
49
|
+
subscriber(WORKFLOWS_STEP_ATTEMPT_TERMINATED, onStepAttemptTerminatedFailureAnnotation(annotations)),
|
|
50
|
+
subscriber(WORKFLOWS_JOB_TERMINATED, onJobTerminatedFailureAnnotation(annotations)),
|
|
49
51
|
subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),
|
|
50
52
|
subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),
|
|
51
53
|
subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {\n RUNNER_JOB_CLAIMED,\n RUNNER_JOB_LEASE_EXPIRED,\n RUNNER_JOB_QUEUED,\n type RunnersEventMap,\n} from '@shipfox/api-runners-dto';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n WORKFLOWS_JOB_EVENT_DELIVERED,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED,\n WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n type WorkflowsEventMapDto,\n workflowsEventSchemas,\n} from '@shipfox/api-workflows-dto';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, workflowsOutbox} from '#db/index.js';\nimport {registerWorkflowsServiceMetrics} from '#metrics/index.js';\nimport {\n createWorkflowRoutes,\n onJobEventDelivered,\n onJobStepsSettled,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from '#presentation/index.js';\nimport {createWorkflowsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createOrchestrationActivities, WORKFLOWS_TASK_QUEUE} from '#temporal/index.js';\n\nexport type {\n Job,\n JobListenerEvent,\n JobListenerEventDisposition,\n RunWorkflowParams,\n Step,\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/index.js';\nexport {\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n ProjectMismatchError,\n runWorkflow,\n WorkflowRunNotCancellableError,\n} from '#core/index.js';\nexport {\n closeDb,\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n db,\n deliverEventToListener,\n getStepById,\n getStepByIdForJobExecution,\n migrationsPath,\n workflowsOutbox,\n} from '#db/index.js';\nexport {loadRunningLeasedStep} from '#presentation/routes/leased-step.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst workflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<WorkflowsEventMapDto & RunnersEventMap>();\n\nexport function createWorkflowsModule({\n agent,\n definitions,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n}: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n}): ShipfoxModule {\n return {\n name: 'workflows',\n database: {db, migrationsPath, databaseNamespace: 'workflows'},\n routes: createWorkflowRoutes({\n agent,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n metrics: registerWorkflowsServiceMetrics,\n publishers: [\n {name: 'workflows', table: workflowsOutbox, db, eventSchemas: workflowsEventSchemas},\n ],\n subscribers: [\n subscriber(WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, onWorkflowRunAttemptCreated),\n subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),\n subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),\n subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),\n subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),\n subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),\n subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed),\n ],\n workers: [\n {\n taskQueue: WORKFLOWS_TASK_QUEUE,\n workflowsPath,\n activities: () =>\n createOrchestrationActivities({agent, integrations, projects, runners, secrets}),\n workflows: [],\n },\n ],\n interModulePresentations: [\n createWorkflowsInterModulePresentation({\n agent,\n definitions,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","RUNNER_JOB_CLAIMED","RUNNER_JOB_LEASE_EXPIRED","RUNNER_JOB_QUEUED","WORKFLOWS_JOB_EVENT_DELIVERED","WORKFLOWS_JOB_STEPS_SETTLED","WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED","WORKFLOWS_WORKFLOW_RUN_CANCELLED","workflowsEventSchemas","subscriberFactory","db","migrationsPath","workflowsOutbox","registerWorkflowsServiceMetrics","createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onWorkflowRunAttemptCreated","onWorkflowRunCancelled","createWorkflowsInterModulePresentation","createOrchestrationActivities","WORKFLOWS_TASK_QUEUE","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","ProjectMismatchError","runWorkflow","WorkflowRunNotCancellableError","closeDb","deliverEventToListener","getStepById","getStepByIdForJobExecution","loadRunningLeasedStep","packageRoot","url","workflowsPath","subscriber","createWorkflowsModule","agent","definitions","annotations","auth","integrations","projects","runners","secrets","workspaces","name","database","databaseNamespace","routes","metrics","publishers","table","eventSchemas","subscribers","workers","taskQueue","activities","workflows","interModulePresentations"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAOvC,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,iBAAiB,QAEZ,2BAA2B;AAGlC,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,sCAAsC,EACtCC,gCAAgC,EAEhCC,qBAAqB,QAChB,6BAA6B;AAEpC,SAA4BC,iBAAiB,QAAO,uBAAuB;AAC3E,SAAQC,EAAE,EAAEC,cAAc,EAAEC,eAAe,QAAO,eAAe;AACjE,SAAQC,+BAA+B,QAAO,oBAAoB;AAClE,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBAAyB;AAChC,SAAQC,sCAAsC,QAAO,gCAAgC;AACrF,SAAQC,6BAA6B,EAAEC,oBAAoB,QAAO,qBAAqB;AAYvF,SACEC,uBAAuB,EACvBC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,oBAAoB,EACpBC,WAAW,EACXC,8BAA8B,QACzB,iBAAiB;AACxB,SACEC,OAAO,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {\n RUNNER_JOB_CLAIMED,\n RUNNER_JOB_LEASE_EXPIRED,\n RUNNER_JOB_QUEUED,\n type RunnersEventMap,\n} from '@shipfox/api-runners-dto';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n WORKFLOWS_JOB_EVENT_DELIVERED,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_JOB_TERMINATED,\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED,\n WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n type WorkflowsEventMapDto,\n workflowsEventSchemas,\n} from '@shipfox/api-workflows-dto';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, workflowsOutbox} from '#db/index.js';\nimport {registerWorkflowsServiceMetrics} from '#metrics/index.js';\nimport {\n createWorkflowRoutes,\n onJobEventDelivered,\n onJobStepsSettled,\n onJobTerminatedFailureAnnotation,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onStepAttemptTerminatedFailureAnnotation,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from '#presentation/index.js';\nimport {createWorkflowsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createOrchestrationActivities, WORKFLOWS_TASK_QUEUE} from '#temporal/index.js';\n\nexport type {\n Job,\n JobListenerEvent,\n JobListenerEventDisposition,\n RunWorkflowParams,\n Step,\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/index.js';\nexport {\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n ProjectMismatchError,\n runWorkflow,\n WorkflowRunNotCancellableError,\n} from '#core/index.js';\nexport {\n closeDb,\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n db,\n deliverEventToListener,\n getStepById,\n getStepByIdForJobExecution,\n migrationsPath,\n workflowsOutbox,\n} from '#db/index.js';\nexport {loadRunningLeasedStep} from '#presentation/routes/leased-step.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst workflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<WorkflowsEventMapDto & RunnersEventMap>();\n\nexport function createWorkflowsModule({\n agent,\n definitions,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n}: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n}): ShipfoxModule {\n return {\n name: 'workflows',\n database: {db, migrationsPath, databaseNamespace: 'workflows'},\n routes: createWorkflowRoutes({\n agent,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n metrics: registerWorkflowsServiceMetrics,\n publishers: [\n {name: 'workflows', table: workflowsOutbox, db, eventSchemas: workflowsEventSchemas},\n ],\n subscribers: [\n subscriber(WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, onWorkflowRunAttemptCreated),\n subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),\n subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),\n subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),\n subscriber(\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n onStepAttemptTerminatedFailureAnnotation(annotations),\n ),\n subscriber(WORKFLOWS_JOB_TERMINATED, onJobTerminatedFailureAnnotation(annotations)),\n subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),\n subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),\n subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed),\n ],\n workers: [\n {\n taskQueue: WORKFLOWS_TASK_QUEUE,\n workflowsPath,\n activities: () =>\n createOrchestrationActivities({agent, integrations, projects, runners, secrets}),\n workflows: [],\n },\n ],\n interModulePresentations: [\n createWorkflowsInterModulePresentation({\n agent,\n definitions,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","RUNNER_JOB_CLAIMED","RUNNER_JOB_LEASE_EXPIRED","RUNNER_JOB_QUEUED","WORKFLOWS_JOB_EVENT_DELIVERED","WORKFLOWS_JOB_STEPS_SETTLED","WORKFLOWS_JOB_TERMINATED","WORKFLOWS_STEP_ATTEMPT_TERMINATED","WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED","WORKFLOWS_WORKFLOW_RUN_CANCELLED","workflowsEventSchemas","subscriberFactory","db","migrationsPath","workflowsOutbox","registerWorkflowsServiceMetrics","createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onJobTerminatedFailureAnnotation","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onStepAttemptTerminatedFailureAnnotation","onWorkflowRunAttemptCreated","onWorkflowRunCancelled","createWorkflowsInterModulePresentation","createOrchestrationActivities","WORKFLOWS_TASK_QUEUE","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","ProjectMismatchError","runWorkflow","WorkflowRunNotCancellableError","closeDb","deliverEventToListener","getStepById","getStepByIdForJobExecution","loadRunningLeasedStep","packageRoot","url","workflowsPath","subscriber","createWorkflowsModule","agent","definitions","annotations","auth","integrations","projects","runners","secrets","workspaces","name","database","databaseNamespace","routes","metrics","publishers","table","eventSchemas","subscribers","workers","taskQueue","activities","workflows","interModulePresentations"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAOvC,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,iBAAiB,QAEZ,2BAA2B;AAGlC,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,wBAAwB,EACxBC,iCAAiC,EACjCC,sCAAsC,EACtCC,gCAAgC,EAEhCC,qBAAqB,QAChB,6BAA6B;AAEpC,SAA4BC,iBAAiB,QAAO,uBAAuB;AAC3E,SAAQC,EAAE,EAAEC,cAAc,EAAEC,eAAe,QAAO,eAAe;AACjE,SAAQC,+BAA+B,QAAO,oBAAoB;AAClE,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,iBAAiB,EACjBC,gCAAgC,EAChCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,wCAAwC,EACxCC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBAAyB;AAChC,SAAQC,sCAAsC,QAAO,gCAAgC;AACrF,SAAQC,6BAA6B,EAAEC,oBAAoB,QAAO,qBAAqB;AAYvF,SACEC,uBAAuB,EACvBC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,oBAAoB,EACpBC,WAAW,EACXC,8BAA8B,QACzB,iBAAiB;AACxB,SACEC,OAAO,EAGPvB,EAAE,EACFwB,sBAAsB,EACtBC,WAAW,EACXC,0BAA0B,EAC1BzB,cAAc,EACdC,eAAe,QACV,eAAe;AACtB,SAAQyB,qBAAqB,QAAO,sCAAsC;AAE1E,MAAMC,cAAczC,QAAQD,QAAQE,cAAc,YAAYyC,GAAG,IAAI;AACrE,MAAMC,gBAAgB3C,QAAQyC,aAAa;AAE3C,MAAMG,aAAahC;AAEnB,OAAO,SAASiC,sBAAsB,EACpCC,KAAK,EACLC,WAAW,EACXC,WAAW,EACXC,IAAI,EACJC,YAAY,EACZC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,UAAU,EAWX;IACC,OAAO;QACLC,MAAM;QACNC,UAAU;YAAC3C;YAAIC;YAAgB2C,mBAAmB;QAAW;QAC7DC,QAAQzC,qBAAqB;YAC3B6B;YACAE;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;QACAK,SAAS3C;QACT4C,YAAY;YACV;gBAACL,MAAM;gBAAaM,OAAO9C;gBAAiBF;gBAAIiD,cAAcnD;YAAqB;SACpF;QACDoD,aAAa;YACXnB,WAAWnC,wCAAwCgB;YACnDmB,WAAWlC,kCAAkCgB;YAC7CkB,WAAWvC,+BAA+Ba;YAC1C0B,WAAWtC,6BAA6Ba;YACxCyB,WACEpC,mCACAgB,yCAAyCwB;YAE3CJ,WAAWrC,0BAA0Ba,iCAAiC4B;YACtEJ,WAAWzC,0BAA0BmB;YACrCsB,WAAWxC,mBAAmBmB;YAC9BqB,WAAW1C,oBAAoBmB;SAChC;QACD2C,SAAS;YACP;gBACEC,WAAWpC;gBACXc;gBACAuB,YAAY,IACVtC,8BAA8B;wBAACkB;wBAAOI;wBAAcC;wBAAUC;wBAASC;oBAAO;gBAChFc,WAAW,EAAE;YACf;SACD;QACDC,0BAA0B;YACxBzC,uCAAuC;gBACrCmB;gBACAC;gBACAG;gBACAC;gBACAC;gBACAC;gBACAC;YACF;SACD;IACH;AACF"}
|
|
@@ -18,4 +18,5 @@ export declare function recordWorkflowListenerExecution(outcome: 'succeeded' | '
|
|
|
18
18
|
export declare function recordWorkflowListenerResolved(reason: ResolutionReason): void;
|
|
19
19
|
export declare function recordListenerEventsCoalesced(batchSize: number): void;
|
|
20
20
|
export declare function recordWorkflowAgentToolWarningFailed(reason: 'budget' | 'lookup' | 'write'): void;
|
|
21
|
+
export declare function recordWorkflowFailureAnnotationFailed(reason: 'lookup' | 'budget' | 'write'): void;
|
|
21
22
|
//# sourceMappingURL=instance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/metrics/instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/metrics/instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0CAA0C,CAAC;AAwGtF,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE/D;AAED,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,EACjD,KAAK,EAAE,eAAe,GAAG,kBAAkB,GAAG,aAAa,GAAG,cAAc,GAC3E,IAAI,CAEN;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAE9E;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAEtE;AAED,wBAAgB,uCAAuC,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAExF;AAED,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAED,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAED,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,OAAO,CAAC,uBAAuB,EAAE,QAAQ,GAAG,WAAW,CAAC,GAC/D,IAAI,CAEN;AAED,wBAAgB,kCAAkC,IAAI,IAAI,CAEzD;AAED,wBAAgB,6CAA6C,CAC3D,MAAM,EAAE,uBAAuB,GAC9B,IAAI,CAEN;AAED,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAElE;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAC5C,IAAI,CAEN;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAE7E;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAEhG;AAED,wBAAgB,qCAAqC,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAEjG"}
|
package/dist/metrics/instance.js
CHANGED
|
@@ -45,6 +45,9 @@ const listenerResolvedCount = meter.createCounter('workflows_listener_resolved',
|
|
|
45
45
|
const agentToolWarningFailedCount = meter.createCounter('workflows_agent_tool_warning_failed', {
|
|
46
46
|
description: 'Agent tool capability warning failures by bounded reason'
|
|
47
47
|
});
|
|
48
|
+
const failureAnnotationFailedCount = meter.createCounter('workflows_failure_annotation_failed', {
|
|
49
|
+
description: 'Failure annotation projection failures by bounded reason'
|
|
50
|
+
});
|
|
48
51
|
const listenerEventsCoalesced = meter.createHistogram('workflows_listener_events_coalesced', {
|
|
49
52
|
description: 'Listener firing batch sizes',
|
|
50
53
|
unit: '1',
|
|
@@ -132,5 +135,10 @@ export function recordWorkflowAgentToolWarningFailed(reason) {
|
|
|
132
135
|
reason
|
|
133
136
|
});
|
|
134
137
|
}
|
|
138
|
+
export function recordWorkflowFailureAnnotationFailed(reason) {
|
|
139
|
+
failureAnnotationFailedCount.add(1, {
|
|
140
|
+
reason
|
|
141
|
+
});
|
|
142
|
+
}
|
|
135
143
|
|
|
136
144
|
//# sourceMappingURL=instance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/metrics/instance.ts"],"sourcesContent":["import {instanceMetrics} from '@shipfox/node-opentelemetry';\nimport type {JobStatus, ResolutionReason} from '#core/entities/job.js';\nimport type {JobExecutionStatus} from '#core/entities/job-execution.js';\nimport type {WorkflowRunStatus} from '#core/entities/workflow-run.js';\nimport type {RuntimeCompletionStatus} from '#core/workflow-scheduling/runtime-dag.js';\n\nconst meter = instanceMetrics.getMeter('workflows');\n\nconst runCreatedCount = meter.createCounter<{provider: string}>('workflows_run_created', {\n description: 'Workflow runs created by bounded trigger provider',\n});\n\nconst displayNameResolutionDegradedCount = meter.createCounter<{\n field: 'workflow.run_name' | 'job.execution_name';\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization';\n}>('workflows_display_name_resolution_degraded', {\n description: 'Display-name resolution degradations by field and bounded cause',\n});\n\nconst runStatusChangedCount = meter.createCounter<{status: WorkflowRunStatus}>(\n 'workflows_run_status_changed',\n {description: 'Workflow run status transitions by resulting status'},\n);\n\nconst jobStatusChangedCount = meter.createCounter<{status: JobStatus}>(\n 'workflows_job_status_changed',\n {description: 'Workflow job status transitions by resulting status'},\n);\n\nconst jobExecutionStatusChangedCount = meter.createCounter<{status: JobExecutionStatus}>(\n 'workflows_job_execution_status_changed',\n {description: 'Workflow job execution status transitions by resulting status'},\n);\n\nconst jobExecutionQueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_queued',\n {\n description: 'Workflow job executions first marked as queued from runner queue events',\n },\n);\n\nconst jobExecutionStartedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_started',\n {\n description: 'Workflow job executions first marked as started from runner claim events',\n },\n);\n\nconst jobExecutionStepsSettledCount = meter.createCounter<{\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>;\n}>('workflows_job_execution_steps_settled', {\n description: 'Job execution steps-settled events enqueued by resulting completion status',\n});\n\nconst jobExecutionTimedOutCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_timed_out',\n {\n description: 'Workflow job executions failed by the execution orchestration timeout path',\n },\n);\n\nconst jobExecutionLeaseExpiryResolvedCount = meter.createCounter<{status: RuntimeCompletionStatus}>(\n 'workflows_job_execution_lease_expiry_resolved',\n {description: 'Runner lease-expiry resolutions by resulting runtime status'},\n);\n\nconst stepRestartEnqueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_step_restart_enqueued',\n {description: 'Durable step restart events enqueued after a restartable gate failure'},\n);\n\nconst listenerEventsReceivedCount = meter.createCounter<{provider: string}>(\n 'workflows_listener_events_received',\n {description: 'Listener integration events buffered by bounded trigger provider'},\n);\n\nconst listenerExecutionsCount = meter.createCounter<{\n outcome: 'succeeded' | 'failed' | 'cancelled';\n}>('workflows_listener_executions', {\n description: 'Listener job execution firings by terminal outcome',\n});\n\nconst listenerResolvedCount = meter.createCounter<{reason: ResolutionReason}>(\n 'workflows_listener_resolved',\n {description: 'Listener resolutions by bounded reason'},\n);\n\nconst agentToolWarningFailedCount = meter.createCounter<{\n reason: 'budget' | 'lookup' | 'write';\n}>('workflows_agent_tool_warning_failed', {\n description: 'Agent tool capability warning failures by bounded reason',\n});\n\nconst listenerEventsCoalesced = meter.createHistogram<Record<string, never>>(\n 'workflows_listener_events_coalesced',\n {\n description: 'Listener firing batch sizes',\n unit: '1',\n advice: {explicitBucketBoundaries: [1, 2, 5, 10, 25, 50, 100, 250]},\n },\n);\n\nexport function recordWorkflowRunCreated(provider: string): void {\n runCreatedCount.add(1, {provider});\n}\n\nexport function recordWorkflowDisplayNameResolutionDegraded(\n field: 'workflow.run_name' | 'job.execution_name',\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization',\n): void {\n displayNameResolutionDegradedCount.add(1, {field, cause});\n}\n\nexport function recordWorkflowRunStatusChanged(status: WorkflowRunStatus): void {\n runStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobStatusChanged(status: JobStatus): void {\n jobStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionStatusChanged(status: JobExecutionStatus): void {\n jobExecutionStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionQueued(): void {\n jobExecutionQueuedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStarted(): void {\n jobExecutionStartedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStepsSettled(\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>,\n): void {\n jobExecutionStepsSettledCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionTimedOut(): void {\n jobExecutionTimedOutCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionLeaseExpiryResolved(\n status: RuntimeCompletionStatus,\n): void {\n jobExecutionLeaseExpiryResolvedCount.add(1, {status});\n}\n\nexport function recordWorkflowStepRestartEnqueued(): void {\n stepRestartEnqueuedCount.add(1);\n}\n\nexport function recordListenerEventReceived(provider: string): void {\n listenerEventsReceivedCount.add(1, {provider});\n}\n\nexport function recordWorkflowListenerExecution(\n outcome: 'succeeded' | 'failed' | 'cancelled',\n): void {\n listenerExecutionsCount.add(1, {outcome});\n}\n\nexport function recordWorkflowListenerResolved(reason: ResolutionReason): void {\n listenerResolvedCount.add(1, {reason});\n}\n\nexport function recordListenerEventsCoalesced(batchSize: number): void {\n listenerEventsCoalesced.record(batchSize);\n}\n\nexport function recordWorkflowAgentToolWarningFailed(reason: 'budget' | 'lookup' | 'write'): void {\n agentToolWarningFailedCount.add(1, {reason});\n}\n"],"names":["instanceMetrics","meter","getMeter","runCreatedCount","createCounter","description","displayNameResolutionDegradedCount","runStatusChangedCount","jobStatusChangedCount","jobExecutionStatusChangedCount","jobExecutionQueuedCount","jobExecutionStartedCount","jobExecutionStepsSettledCount","jobExecutionTimedOutCount","jobExecutionLeaseExpiryResolvedCount","stepRestartEnqueuedCount","listenerEventsReceivedCount","listenerExecutionsCount","listenerResolvedCount","agentToolWarningFailedCount","listenerEventsCoalesced","createHistogram","unit","advice","explicitBucketBoundaries","recordWorkflowRunCreated","provider","add","recordWorkflowDisplayNameResolutionDegraded","field","cause","recordWorkflowRunStatusChanged","status","recordWorkflowJobStatusChanged","recordWorkflowJobExecutionStatusChanged","recordWorkflowJobExecutionQueued","recordWorkflowJobExecutionStarted","recordWorkflowJobExecutionStepsSettled","recordWorkflowJobExecutionTimedOut","recordWorkflowJobExecutionLeaseExpiryResolved","recordWorkflowStepRestartEnqueued","recordListenerEventReceived","recordWorkflowListenerExecution","outcome","recordWorkflowListenerResolved","reason","recordListenerEventsCoalesced","batchSize","record","recordWorkflowAgentToolWarningFailed"],"mappings":"AAAA,SAAQA,eAAe,QAAO,8BAA8B;AAM5D,MAAMC,QAAQD,gBAAgBE,QAAQ,CAAC;AAEvC,MAAMC,kBAAkBF,MAAMG,aAAa,CAAqB,yBAAyB;IACvFC,aAAa;AACf;AAEA,MAAMC,qCAAqCL,MAAMG,aAAa,CAG3D,8CAA8C;IAC/CC,aAAa;AACf;AAEA,MAAME,wBAAwBN,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMG,wBAAwBP,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMI,iCAAiCR,MAAMG,aAAa,CACxD,0CACA;IAACC,aAAa;AAA+D;AAG/E,MAAMK,0BAA0BT,MAAMG,aAAa,CACjD,kCACA;IACEC,aAAa;AACf;AAGF,MAAMM,2BAA2BV,MAAMG,aAAa,CAClD,mCACA;IACEC,aAAa;AACf;AAGF,MAAMO,gCAAgCX,MAAMG,aAAa,CAEtD,yCAAyC;IAC1CC,aAAa;AACf;AAEA,MAAMQ,4BAA4BZ,MAAMG,aAAa,CACnD,qCACA;IACEC,aAAa;AACf;AAGF,MAAMS,uCAAuCb,MAAMG,aAAa,CAC9D,iDACA;IAACC,aAAa;AAA6D;AAG7E,MAAMU,2BAA2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;AAEA,OAAO,SAASY,8CACdP,MAA+B;IAE/BlB,qCAAqCa,GAAG,CAAC,GAAG;QAACK;IAAM;AACrD;AAEA,OAAO,SAASQ;IACdzB,yBAAyBY,GAAG,CAAC;AAC/B;AAEA,OAAO,SAASc,4BAA4Bf,QAAgB;IAC1DV,4BAA4BW,GAAG,CAAC,GAAG;QAACD;IAAQ;AAC9C;AAEA,OAAO,SAASgB,gCACdC,OAA6C;IAE7C1B,wBAAwBU,GAAG,CAAC,GAAG;QAACgB;IAAO;AACzC;AAEA,OAAO,SAASC,+BAA+BC,MAAwB;IACrE3B,sBAAsBS,GAAG,CAAC,GAAG;QAACkB;IAAM;AACtC;AAEA,OAAO,SAASC,8BAA8BC,SAAiB;IAC7D3B,wBAAwB4B,MAAM,CAACD;AACjC;AAEA,OAAO,SAASE,qCAAqCJ,MAAqC;IACxF1B,4BAA4BQ,GAAG,CAAC,GAAG;QAACkB;IAAM;AAC5C"}
|
|
1
|
+
{"version":3,"sources":["../../src/metrics/instance.ts"],"sourcesContent":["import {instanceMetrics} from '@shipfox/node-opentelemetry';\nimport type {JobStatus, ResolutionReason} from '#core/entities/job.js';\nimport type {JobExecutionStatus} from '#core/entities/job-execution.js';\nimport type {WorkflowRunStatus} from '#core/entities/workflow-run.js';\nimport type {RuntimeCompletionStatus} from '#core/workflow-scheduling/runtime-dag.js';\n\nconst meter = instanceMetrics.getMeter('workflows');\n\nconst runCreatedCount = meter.createCounter<{provider: string}>('workflows_run_created', {\n description: 'Workflow runs created by bounded trigger provider',\n});\n\nconst displayNameResolutionDegradedCount = meter.createCounter<{\n field: 'workflow.run_name' | 'job.execution_name';\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization';\n}>('workflows_display_name_resolution_degraded', {\n description: 'Display-name resolution degradations by field and bounded cause',\n});\n\nconst runStatusChangedCount = meter.createCounter<{status: WorkflowRunStatus}>(\n 'workflows_run_status_changed',\n {description: 'Workflow run status transitions by resulting status'},\n);\n\nconst jobStatusChangedCount = meter.createCounter<{status: JobStatus}>(\n 'workflows_job_status_changed',\n {description: 'Workflow job status transitions by resulting status'},\n);\n\nconst jobExecutionStatusChangedCount = meter.createCounter<{status: JobExecutionStatus}>(\n 'workflows_job_execution_status_changed',\n {description: 'Workflow job execution status transitions by resulting status'},\n);\n\nconst jobExecutionQueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_queued',\n {\n description: 'Workflow job executions first marked as queued from runner queue events',\n },\n);\n\nconst jobExecutionStartedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_started',\n {\n description: 'Workflow job executions first marked as started from runner claim events',\n },\n);\n\nconst jobExecutionStepsSettledCount = meter.createCounter<{\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>;\n}>('workflows_job_execution_steps_settled', {\n description: 'Job execution steps-settled events enqueued by resulting completion status',\n});\n\nconst jobExecutionTimedOutCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_timed_out',\n {\n description: 'Workflow job executions failed by the execution orchestration timeout path',\n },\n);\n\nconst jobExecutionLeaseExpiryResolvedCount = meter.createCounter<{status: RuntimeCompletionStatus}>(\n 'workflows_job_execution_lease_expiry_resolved',\n {description: 'Runner lease-expiry resolutions by resulting runtime status'},\n);\n\nconst stepRestartEnqueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_step_restart_enqueued',\n {description: 'Durable step restart events enqueued after a restartable gate failure'},\n);\n\nconst listenerEventsReceivedCount = meter.createCounter<{provider: string}>(\n 'workflows_listener_events_received',\n {description: 'Listener integration events buffered by bounded trigger provider'},\n);\n\nconst listenerExecutionsCount = meter.createCounter<{\n outcome: 'succeeded' | 'failed' | 'cancelled';\n}>('workflows_listener_executions', {\n description: 'Listener job execution firings by terminal outcome',\n});\n\nconst listenerResolvedCount = meter.createCounter<{reason: ResolutionReason}>(\n 'workflows_listener_resolved',\n {description: 'Listener resolutions by bounded reason'},\n);\n\nconst agentToolWarningFailedCount = meter.createCounter<{\n reason: 'budget' | 'lookup' | 'write';\n}>('workflows_agent_tool_warning_failed', {\n description: 'Agent tool capability warning failures by bounded reason',\n});\n\nconst failureAnnotationFailedCount = meter.createCounter<{\n reason: 'lookup' | 'budget' | 'write';\n}>('workflows_failure_annotation_failed', {\n description: 'Failure annotation projection failures by bounded reason',\n});\n\nconst listenerEventsCoalesced = meter.createHistogram<Record<string, never>>(\n 'workflows_listener_events_coalesced',\n {\n description: 'Listener firing batch sizes',\n unit: '1',\n advice: {explicitBucketBoundaries: [1, 2, 5, 10, 25, 50, 100, 250]},\n },\n);\n\nexport function recordWorkflowRunCreated(provider: string): void {\n runCreatedCount.add(1, {provider});\n}\n\nexport function recordWorkflowDisplayNameResolutionDegraded(\n field: 'workflow.run_name' | 'job.execution_name',\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization',\n): void {\n displayNameResolutionDegradedCount.add(1, {field, cause});\n}\n\nexport function recordWorkflowRunStatusChanged(status: WorkflowRunStatus): void {\n runStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobStatusChanged(status: JobStatus): void {\n jobStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionStatusChanged(status: JobExecutionStatus): void {\n jobExecutionStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionQueued(): void {\n jobExecutionQueuedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStarted(): void {\n jobExecutionStartedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStepsSettled(\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>,\n): void {\n jobExecutionStepsSettledCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionTimedOut(): void {\n jobExecutionTimedOutCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionLeaseExpiryResolved(\n status: RuntimeCompletionStatus,\n): void {\n jobExecutionLeaseExpiryResolvedCount.add(1, {status});\n}\n\nexport function recordWorkflowStepRestartEnqueued(): void {\n stepRestartEnqueuedCount.add(1);\n}\n\nexport function recordListenerEventReceived(provider: string): void {\n listenerEventsReceivedCount.add(1, {provider});\n}\n\nexport function recordWorkflowListenerExecution(\n outcome: 'succeeded' | 'failed' | 'cancelled',\n): void {\n listenerExecutionsCount.add(1, {outcome});\n}\n\nexport function recordWorkflowListenerResolved(reason: ResolutionReason): void {\n listenerResolvedCount.add(1, {reason});\n}\n\nexport function recordListenerEventsCoalesced(batchSize: number): void {\n listenerEventsCoalesced.record(batchSize);\n}\n\nexport function recordWorkflowAgentToolWarningFailed(reason: 'budget' | 'lookup' | 'write'): void {\n agentToolWarningFailedCount.add(1, {reason});\n}\n\nexport function recordWorkflowFailureAnnotationFailed(reason: 'lookup' | 'budget' | 'write'): void {\n failureAnnotationFailedCount.add(1, {reason});\n}\n"],"names":["instanceMetrics","meter","getMeter","runCreatedCount","createCounter","description","displayNameResolutionDegradedCount","runStatusChangedCount","jobStatusChangedCount","jobExecutionStatusChangedCount","jobExecutionQueuedCount","jobExecutionStartedCount","jobExecutionStepsSettledCount","jobExecutionTimedOutCount","jobExecutionLeaseExpiryResolvedCount","stepRestartEnqueuedCount","listenerEventsReceivedCount","listenerExecutionsCount","listenerResolvedCount","agentToolWarningFailedCount","failureAnnotationFailedCount","listenerEventsCoalesced","createHistogram","unit","advice","explicitBucketBoundaries","recordWorkflowRunCreated","provider","add","recordWorkflowDisplayNameResolutionDegraded","field","cause","recordWorkflowRunStatusChanged","status","recordWorkflowJobStatusChanged","recordWorkflowJobExecutionStatusChanged","recordWorkflowJobExecutionQueued","recordWorkflowJobExecutionStarted","recordWorkflowJobExecutionStepsSettled","recordWorkflowJobExecutionTimedOut","recordWorkflowJobExecutionLeaseExpiryResolved","recordWorkflowStepRestartEnqueued","recordListenerEventReceived","recordWorkflowListenerExecution","outcome","recordWorkflowListenerResolved","reason","recordListenerEventsCoalesced","batchSize","record","recordWorkflowAgentToolWarningFailed","recordWorkflowFailureAnnotationFailed"],"mappings":"AAAA,SAAQA,eAAe,QAAO,8BAA8B;A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tC;AAEA,OAAO,SAASC,8BAA8BC,SAAiB;IAC7D3B,wBAAwB4B,MAAM,CAACD;AACjC;AAEA,OAAO,SAASE,qCAAqCJ,MAAqC;IACxF3B,4BAA4BS,GAAG,CAAC,GAAG;QAACkB;IAAM;AAC5C;AAEA,OAAO,SAASK,sCAAsCL,MAAqC;IACzF1B,6BAA6BQ,GAAG,CAAC,GAAG;QAACkB;IAAM;AAC7C"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EvaluationTraceDto } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import type { PersistedEvaluationTraceEntry } from '#core/entities/step.js';
|
|
3
|
+
export declare function toEvaluationTraceDto(trace: readonly PersistedEvaluationTraceEntry[] | null | undefined): EvaluationTraceDto | null;
|
|
4
|
+
//# sourceMappingURL=evaluation-trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation-trace.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/evaluation-trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAA0B,MAAM,4BAA4B,CAAC;AAC5F,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAE1E,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,6BAA6B,EAAE,GAAG,IAAI,GAAG,SAAS,GACjE,kBAAkB,GAAG,IAAI,CAG3B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function toEvaluationTraceDto(trace) {
|
|
2
|
+
if (trace === null || trace === undefined) return null;
|
|
3
|
+
return trace.map(toEvaluationTraceEntryDto);
|
|
4
|
+
}
|
|
5
|
+
function toEvaluationTraceEntryDto(entry) {
|
|
6
|
+
if ('dropped' in entry) return {
|
|
7
|
+
truncated: true,
|
|
8
|
+
dropped: entry.dropped
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
expression: entry.expression,
|
|
12
|
+
roots: [
|
|
13
|
+
...entry.roots
|
|
14
|
+
],
|
|
15
|
+
fill_target: entry.fillTarget,
|
|
16
|
+
evaluated_at: entry.evaluatedAt,
|
|
17
|
+
field: entry.field,
|
|
18
|
+
...entry.value === undefined ? {} : {
|
|
19
|
+
value: entry.value
|
|
20
|
+
},
|
|
21
|
+
...entry.truncated === undefined ? {} : {
|
|
22
|
+
truncated: entry.truncated
|
|
23
|
+
},
|
|
24
|
+
...entry.exprTruncated === undefined ? {} : {
|
|
25
|
+
expr_truncated: entry.exprTruncated
|
|
26
|
+
},
|
|
27
|
+
...entry.reference === undefined ? {} : {
|
|
28
|
+
reference: entry.reference
|
|
29
|
+
},
|
|
30
|
+
...entry.degraded === undefined ? {} : {
|
|
31
|
+
degraded: entry.degraded
|
|
32
|
+
},
|
|
33
|
+
...entry.envKey === undefined ? {} : {
|
|
34
|
+
env_key: entry.envKey
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=evaluation-trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/evaluation-trace.ts"],"sourcesContent":["import type {EvaluationTraceDto, EvaluationTraceEntryDto} from '@shipfox/api-workflows-dto';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\n\nexport function toEvaluationTraceDto(\n trace: readonly PersistedEvaluationTraceEntry[] | null | undefined,\n): EvaluationTraceDto | null {\n if (trace === null || trace === undefined) return null;\n return trace.map(toEvaluationTraceEntryDto);\n}\n\nfunction toEvaluationTraceEntryDto(entry: PersistedEvaluationTraceEntry): EvaluationTraceEntryDto {\n if ('dropped' in entry) return {truncated: true, dropped: entry.dropped};\n\n return {\n expression: entry.expression,\n roots: [...entry.roots],\n fill_target: entry.fillTarget,\n evaluated_at: entry.evaluatedAt,\n field: entry.field,\n ...(entry.value === undefined ? {} : {value: entry.value}),\n ...(entry.truncated === undefined ? {} : {truncated: entry.truncated}),\n ...(entry.exprTruncated === undefined ? {} : {expr_truncated: entry.exprTruncated}),\n ...(entry.reference === undefined ? {} : {reference: entry.reference}),\n ...(entry.degraded === undefined ? {} : {degraded: entry.degraded}),\n ...(entry.envKey === undefined ? {} : {env_key: entry.envKey}),\n };\n}\n"],"names":["toEvaluationTraceDto","trace","undefined","map","toEvaluationTraceEntryDto","entry","truncated","dropped","expression","roots","fill_target","fillTarget","evaluated_at","evaluatedAt","field","value","exprTruncated","expr_truncated","reference","degraded","envKey","env_key"],"mappings":"AAGA,OAAO,SAASA,qBACdC,KAAkE;IAElE,IAAIA,UAAU,QAAQA,UAAUC,WAAW,OAAO;IAClD,OAAOD,MAAME,GAAG,CAACC;AACnB;AAEA,SAASA,0BAA0BC,KAAoC;IACrE,IAAI,aAAaA,OAAO,OAAO;QAACC,WAAW;QAAMC,SAASF,MAAME,OAAO;IAAA;IAEvE,OAAO;QACLC,YAAYH,MAAMG,UAAU;QAC5BC,OAAO;eAAIJ,MAAMI,KAAK;SAAC;QACvBC,aAAaL,MAAMM,UAAU;QAC7BC,cAAcP,MAAMQ,WAAW;QAC/BC,OAAOT,MAAMS,KAAK;QAClB,GAAIT,MAAMU,KAAK,KAAKb,YAAY,CAAC,IAAI;YAACa,OAAOV,MAAMU,KAAK;QAAA,CAAC;QACzD,GAAIV,MAAMC,SAAS,KAAKJ,YAAY,CAAC,IAAI;YAACI,WAAWD,MAAMC,SAAS;QAAA,CAAC;QACrE,GAAID,MAAMW,aAAa,KAAKd,YAAY,CAAC,IAAI;YAACe,gBAAgBZ,MAAMW,aAAa;QAAA,CAAC;QAClF,GAAIX,MAAMa,SAAS,KAAKhB,YAAY,CAAC,IAAI;YAACgB,WAAWb,MAAMa,SAAS;QAAA,CAAC;QACrE,GAAIb,MAAMc,QAAQ,KAAKjB,YAAY,CAAC,IAAI;YAACiB,UAAUd,MAAMc,QAAQ;QAAA,CAAC;QAClE,GAAId,MAAMe,MAAM,KAAKlB,YAAY,CAAC,IAAI;YAACmB,SAAShB,MAAMe,MAAM;QAAA,CAAC;IAC/D;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
export { toEvaluationTraceDto } from './evaluation-trace.js';
|
|
1
2
|
export { toJobDto, toJobExecutionDto } from './job.js';
|
|
2
|
-
export { toStepAttemptDto, toStepDto } from './step.js';
|
|
3
|
+
export { toStepAttemptDetailResponseDto, toStepAttemptDto, toStepDto } from './step.js';
|
|
3
4
|
export { toRunAttemptDto, toRunDto, toRunListItemDto } from './workflow-run.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,8BAA8B,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AACtF,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export { toEvaluationTraceDto } from './evaluation-trace.js';
|
|
1
2
|
export { toJobDto, toJobExecutionDto } from './job.js';
|
|
2
|
-
export { toStepAttemptDto, toStepDto } from './step.js';
|
|
3
|
+
export { toStepAttemptDetailResponseDto, toStepAttemptDto, toStepDto } from './step.js';
|
|
3
4
|
export { toRunAttemptDto, toRunDto, toRunListItemDto } from './workflow-run.js';
|
|
4
5
|
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/dto/index.ts"],"sourcesContent":["export {toJobDto, toJobExecutionDto} from './job.js';\nexport {toStepAttemptDto, toStepDto} from './step.js';\nexport {toRunAttemptDto, toRunDto, toRunListItemDto} from './workflow-run.js';\n"],"names":["toJobDto","toJobExecutionDto","toStepAttemptDto","toStepDto","toRunAttemptDto","toRunDto","toRunListItemDto"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,iBAAiB,QAAO,WAAW;AACrD,SAAQC,gBAAgB,EAAEC,SAAS,QAAO,YAAY;
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/index.ts"],"sourcesContent":["export {toEvaluationTraceDto} from './evaluation-trace.js';\nexport {toJobDto, toJobExecutionDto} from './job.js';\nexport {toStepAttemptDetailResponseDto, toStepAttemptDto, toStepDto} from './step.js';\nexport {toRunAttemptDto, toRunDto, toRunListItemDto} from './workflow-run.js';\n"],"names":["toEvaluationTraceDto","toJobDto","toJobExecutionDto","toStepAttemptDetailResponseDto","toStepAttemptDto","toStepDto","toRunAttemptDto","toRunDto","toRunListItemDto"],"mappings":"AAAA,SAAQA,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,QAAQ,EAAEC,iBAAiB,QAAO,WAAW;AACrD,SAAQC,8BAA8B,EAAEC,gBAAgB,EAAEC,SAAS,QAAO,YAAY;AACtF,SAAQC,eAAe,EAAEC,QAAQ,EAAEC,gBAAgB,QAAO,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAGlE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CA2CzC;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,eAAe,CAmB7E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toEvaluationTraceDto } from './evaluation-trace.js';
|
|
1
2
|
export function toJobDto(job) {
|
|
2
3
|
return {
|
|
3
4
|
id: job.id,
|
|
@@ -8,6 +9,9 @@ export function toJobDto(job) {
|
|
|
8
9
|
status: job.status,
|
|
9
10
|
status_reason: job.statusReason,
|
|
10
11
|
carried_over: job.carriedOver,
|
|
12
|
+
success: job.success ?? null,
|
|
13
|
+
runner: job.runner,
|
|
14
|
+
evaluation_trace: toEvaluationTraceDto(job.evaluationTrace),
|
|
11
15
|
listening: job.listeningOn === null ? null : {
|
|
12
16
|
on: job.listeningOn,
|
|
13
17
|
until: job.listeningUntil,
|
|
@@ -45,8 +49,10 @@ export function toJobExecutionDto(jobExecution) {
|
|
|
45
49
|
name: jobExecution.name,
|
|
46
50
|
status: jobExecution.status,
|
|
47
51
|
status_reason: jobExecution.statusReason,
|
|
52
|
+
runner: jobExecution.runner,
|
|
48
53
|
trigger_events: jobExecution.triggerEvents,
|
|
49
54
|
outputs: jobExecution.outputs,
|
|
55
|
+
evaluation_trace: toEvaluationTraceDto(jobExecution.evaluationTrace),
|
|
50
56
|
queued_at: jobExecution.queuedAt?.toISOString() ?? null,
|
|
51
57
|
started_at: jobExecution.startedAt?.toISOString() ?? null,
|
|
52
58
|
finished_at: jobExecution.finishedAt?.toISOString() ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/dto/job.ts"],"sourcesContent":["import type {JobDto, JobExecutionDto} from '@shipfox/api-workflows-dto';\nimport type {Job} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\n\nexport function toJobDto(job: Job): JobDto {\n return {\n id: job.id,\n run_attempt_id: job.workflowRunAttemptId,\n key: job.key,\n name: job.name,\n mode: job.mode,\n status: job.status,\n status_reason: job.statusReason,\n carried_over: job.carriedOver,\n listening:\n job.listeningOn === null\n ? null\n : {\n on: job.listeningOn,\n until: job.listeningUntil,\n timeout_ms: job.listeningTimeoutMs,\n max_executions: job.maxExecutions,\n batch:\n job.batchDebounceMs === null &&\n job.batchMaxSize === null &&\n job.batchMaxWaitMs === null\n ? null\n : {\n ...(job.batchDebounceMs === null ? {} : {debounce_ms: job.batchDebounceMs}),\n ...(job.batchMaxSize === null ? {} : {max_size: job.batchMaxSize}),\n ...(job.batchMaxWaitMs === null ? {} : {max_wait_ms: job.batchMaxWaitMs}),\n },\n on_resolve: job.onResolve ?? 'finish',\n execution_timeout_ms: job.executionTimeoutMs ?? null,\n name: job.name,\n },\n listener_status: job.listenerStatus,\n resolution_reason: job.resolutionReason,\n outputs: job.outputs,\n dependencies: job.dependencies,\n position: job.position,\n created_at: job.createdAt.toISOString(),\n updated_at: job.updatedAt.toISOString(),\n };\n}\n\nexport function toJobExecutionDto(jobExecution: JobExecution): JobExecutionDto {\n return {\n id: jobExecution.id,\n job_id: jobExecution.jobId,\n sequence: jobExecution.sequence,\n name: jobExecution.name,\n status: jobExecution.status,\n status_reason: jobExecution.statusReason,\n trigger_events: jobExecution.triggerEvents,\n outputs: jobExecution.outputs,\n queued_at: jobExecution.queuedAt?.toISOString() ?? null,\n started_at: jobExecution.startedAt?.toISOString() ?? null,\n finished_at: jobExecution.finishedAt?.toISOString() ?? null,\n timed_out_at: jobExecution.timedOutAt?.toISOString() ?? null,\n created_at: jobExecution.createdAt.toISOString(),\n updated_at: jobExecution.updatedAt.toISOString(),\n };\n}\n"],"names":["toJobDto","job","id","run_attempt_id","workflowRunAttemptId","key","name","mode","status","status_reason","statusReason","carried_over","carriedOver","listening","listeningOn","on","until","listeningUntil","timeout_ms","listeningTimeoutMs","max_executions","maxExecutions","batch","batchDebounceMs","batchMaxSize","batchMaxWaitMs","debounce_ms","max_size","max_wait_ms","on_resolve","onResolve","execution_timeout_ms","executionTimeoutMs","listener_status","listenerStatus","resolution_reason","resolutionReason","outputs","dependencies","position","created_at","createdAt","toISOString","updated_at","updatedAt","toJobExecutionDto","jobExecution","job_id","jobId","sequence","trigger_events","triggerEvents","queued_at","queuedAt","started_at","startedAt","finished_at","finishedAt","timed_out_at","timedOutAt"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/job.ts"],"sourcesContent":["import type {JobDto, JobExecutionDto} from '@shipfox/api-workflows-dto';\nimport type {Job} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\nimport {toEvaluationTraceDto} from './evaluation-trace.js';\n\nexport function toJobDto(job: Job): JobDto {\n return {\n id: job.id,\n run_attempt_id: job.workflowRunAttemptId,\n key: job.key,\n name: job.name,\n mode: job.mode,\n status: job.status,\n status_reason: job.statusReason,\n carried_over: job.carriedOver,\n success: job.success ?? null,\n runner: job.runner,\n evaluation_trace: toEvaluationTraceDto(job.evaluationTrace),\n listening:\n job.listeningOn === null\n ? null\n : {\n on: job.listeningOn,\n until: job.listeningUntil,\n timeout_ms: job.listeningTimeoutMs,\n max_executions: job.maxExecutions,\n batch:\n job.batchDebounceMs === null &&\n job.batchMaxSize === null &&\n job.batchMaxWaitMs === null\n ? null\n : {\n ...(job.batchDebounceMs === null ? {} : {debounce_ms: job.batchDebounceMs}),\n ...(job.batchMaxSize === null ? {} : {max_size: job.batchMaxSize}),\n ...(job.batchMaxWaitMs === null ? {} : {max_wait_ms: job.batchMaxWaitMs}),\n },\n on_resolve: job.onResolve ?? 'finish',\n execution_timeout_ms: job.executionTimeoutMs ?? null,\n name: job.name,\n },\n listener_status: job.listenerStatus,\n resolution_reason: job.resolutionReason,\n outputs: job.outputs,\n dependencies: job.dependencies,\n position: job.position,\n created_at: job.createdAt.toISOString(),\n updated_at: job.updatedAt.toISOString(),\n };\n}\n\nexport function toJobExecutionDto(jobExecution: JobExecution): JobExecutionDto {\n return {\n id: jobExecution.id,\n job_id: jobExecution.jobId,\n sequence: jobExecution.sequence,\n name: jobExecution.name,\n status: jobExecution.status,\n status_reason: jobExecution.statusReason,\n runner: jobExecution.runner,\n trigger_events: jobExecution.triggerEvents,\n outputs: jobExecution.outputs,\n evaluation_trace: toEvaluationTraceDto(jobExecution.evaluationTrace),\n queued_at: jobExecution.queuedAt?.toISOString() ?? null,\n started_at: jobExecution.startedAt?.toISOString() ?? null,\n finished_at: jobExecution.finishedAt?.toISOString() ?? null,\n timed_out_at: jobExecution.timedOutAt?.toISOString() ?? null,\n created_at: jobExecution.createdAt.toISOString(),\n updated_at: jobExecution.updatedAt.toISOString(),\n };\n}\n"],"names":["toEvaluationTraceDto","toJobDto","job","id","run_attempt_id","workflowRunAttemptId","key","name","mode","status","status_reason","statusReason","carried_over","carriedOver","success","runner","evaluation_trace","evaluationTrace","listening","listeningOn","on","until","listeningUntil","timeout_ms","listeningTimeoutMs","max_executions","maxExecutions","batch","batchDebounceMs","batchMaxSize","batchMaxWaitMs","debounce_ms","max_size","max_wait_ms","on_resolve","onResolve","execution_timeout_ms","executionTimeoutMs","listener_status","listenerStatus","resolution_reason","resolutionReason","outputs","dependencies","position","created_at","createdAt","toISOString","updated_at","updatedAt","toJobExecutionDto","jobExecution","job_id","jobId","sequence","trigger_events","triggerEvents","queued_at","queuedAt","started_at","startedAt","finished_at","finishedAt","timed_out_at","timedOutAt"],"mappings":"AAGA,SAAQA,oBAAoB,QAAO,wBAAwB;AAE3D,OAAO,SAASC,SAASC,GAAQ;IAC/B,OAAO;QACL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CAACF,WAAW;IACvC;AACF;AAEA,OAAO,SAASG,kBAAkBC,YAA0B;IAC1D,OAAO;QACLhD,IAAIgD,aAAahD,EAAE;QACnBiD,QAAQD,aAAaE,KAAK;QAC1BC,UAAUH,aAAaG,QAAQ;QAC/B/C,MAAM4C,aAAa5C,IAAI;QACvBE,QAAQ0C,aAAa1C,MAAM;QAC3BC,eAAeyC,aAAaxC,YAAY;QACxCI,QAAQoC,aAAapC,MAAM;QAC3BwC,gBAAgBJ,aAAaK,aAAa;QAC1Cd,SAASS,aAAaT,OAAO;QAC7B1B,kBAAkBhB,qBAAqBmD,aAAalC,eAAe;QACnEwC,WAAWN,aAAaO,QAAQ,EAAEX,iBAAiB;QACnDY,YAAYR,aAAaS,SAAS,EAAEb,iBAAiB;QACrDc,aAAaV,aAAaW,UAAU,EAAEf,iBAAiB;QACvDgB,cAAcZ,aAAaa,UAAU,EAAEjB,iBAAiB;QACxDF,YAAYM,aAAaL,SAAS,CAACC,WAAW;QAC9CC,YAAYG,aAAaF,SAAS,CAACF,WAAW;IAChD;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type StepAttemptDto, type StepDto, type StepErrorDto } from '@shipfox/api-workflows-dto';
|
|
1
|
+
import { type StepAttemptDetailResponseDto, type StepAttemptDto, type StepDto, type StepErrorDto } from '@shipfox/api-workflows-dto';
|
|
2
2
|
import type { Step, StepAttempt } from '#core/entities/step.js';
|
|
3
3
|
export declare function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null;
|
|
4
4
|
export declare function toStepDto(step: Step): StepDto;
|
|
5
5
|
export declare function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto;
|
|
6
|
+
export declare function toStepAttemptDetailResponseDto(step: Step, attempt: StepAttempt): StepAttemptDetailResponseDto;
|
|
6
7
|
//# sourceMappingURL=step.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,OAAO,EAEZ,KAAK,YAAY,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,OAAO,EAEZ,KAAK,YAAY,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAoC9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAahG;AA0CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAqB7C;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiBrE;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,GACnB,4BAA4B,CAQ9B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { agentConfigIssueSchema, stepErrorReasonSchema } from '@shipfox/api-workflows-dto';
|
|
2
2
|
import { GATE_EVALUATION_ERROR_REASON } from '#core/step-transition/evaluate-gate.js';
|
|
3
|
+
import { toEvaluationTraceDto } from './evaluation-trace.js';
|
|
3
4
|
// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner
|
|
4
5
|
// contract rather than trusting whatever shape the row happens to hold. `category`
|
|
5
6
|
// is not stored on the row; the caller derives it from the step type and passes it
|
|
@@ -124,8 +125,10 @@ export function toStepDto(step) {
|
|
|
124
125
|
name: step.name,
|
|
125
126
|
source_location: toStepSourceLocationDto(step.sourceLocation),
|
|
126
127
|
status: step.status,
|
|
128
|
+
status_reason: step.statusReason,
|
|
127
129
|
type: step.type,
|
|
128
130
|
config: step.config,
|
|
131
|
+
evaluation_trace: toEvaluationTraceDto(step.evaluationTrace),
|
|
129
132
|
error: toStepErrorDto(step.error, step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user'),
|
|
130
133
|
position: step.position,
|
|
131
134
|
current_attempt: step.currentAttempt,
|
|
@@ -158,5 +161,14 @@ export function toStepAttemptDto(attempt) {
|
|
|
158
161
|
finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null
|
|
159
162
|
};
|
|
160
163
|
}
|
|
164
|
+
export function toStepAttemptDetailResponseDto(step, attempt) {
|
|
165
|
+
return {
|
|
166
|
+
step_id: step.id,
|
|
167
|
+
attempt: attempt.attempt,
|
|
168
|
+
authored_config: step.authoredConfig,
|
|
169
|
+
config: attempt.config,
|
|
170
|
+
evaluation_trace: toEvaluationTraceDto(attempt.evaluationTrace)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
161
173
|
|
|
162
174
|
//# sourceMappingURL=step.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/dto/step.ts"],"sourcesContent":["import {\n agentConfigIssueSchema,\n type StepAttemptDto,\n type StepDto,\n type StepErrorCategoryDto,\n type StepErrorDto,\n type StepGateResultDto,\n stepErrorReasonSchema,\n} from '@shipfox/api-workflows-dto';\nimport type {Step, StepAttempt} from '#core/entities/step.js';\nimport {GATE_EVALUATION_ERROR_REASON} from '#core/step-transition/evaluate-gate.js';\n\n// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner\n// contract rather than trusting whatever shape the row happens to hold. `category`\n// is not stored on the row; the caller derives it from the step type and passes it\n// in (server-authoritative, never trusted from the runner).\nfunction toStepErrorDto(\n error: Record<string, unknown> | null,\n category: StepErrorCategoryDto,\n): StepErrorDto {\n if (error === null) return null;\n const message = typeof error.message === 'string' ? error.message : '';\n const exitCode = error.exitCode;\n const signal = typeof error.signal === 'string' ? error.signal : undefined;\n const field = typeof error.field === 'string' ? error.field : undefined;\n const source = typeof error.source === 'string' ? error.source : undefined;\n const reason = stepErrorReasonSchema.safeParse(error.reason);\n const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);\n return {\n message,\n ...(exitCode === null || typeof exitCode === 'number' ? {exit_code: exitCode} : {}),\n ...(signal === undefined ? {} : {signal}),\n ...(reason.success ? {reason: reason.data} : {}),\n ...(field === undefined ? {} : {field}),\n ...(source === undefined ? {} : {source}),\n ...(agentConfigIssue.success ? {agent_config_issue: agentConfigIssue.data} : {}),\n category,\n };\n}\n\n// Inverse of toStepErrorDto: reported wire errors land on the domain row in\n// camelCase so the read path renders them back without a special case. `category`\n// is intentionally NOT persisted: the server derives it from the step type on\n// read, so a runner-supplied category is ignored here.\nexport function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null {\n if (!error) return null;\n return {\n message: error.message,\n ...(error.exit_code === null || typeof error.exit_code === 'number'\n ? {exitCode: error.exit_code}\n : {}),\n ...(typeof error.signal === 'string' ? {signal: error.signal} : {}),\n ...(error.reason === undefined ? {} : {reason: error.reason}),\n ...(error.field === undefined ? {} : {field: error.field}),\n ...(error.source === undefined ? {} : {source: error.source}),\n ...(error.agent_config_issue === undefined ? {} : {agentConfigIssue: error.agent_config_issue}),\n };\n}\n\nfunction isIntOrNull(value: unknown): value is number | null {\n return value === null || (typeof value === 'number' && Number.isInteger(value));\n}\n\nfunction toStepGateResultDto(\n gateResult: Record<string, unknown> | null,\n status: string,\n): StepGateResultDto {\n if (gateResult === null) {\n return status === 'running' || status === 'pending' ? {kind: 'not_evaluated'} : {kind: 'none'};\n }\n\n const exitCode = gateResult.exit_code;\n const passed = gateResult.passed;\n const source = gateResult.source;\n const reason = gateResult.reason;\n\n if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'passed', passed, source, exit_code: exitCode};\n }\n\n if (\n passed === false &&\n gateResult.uncheckable === true &&\n typeof reason === 'string' &&\n isIntOrNull(exitCode)\n ) {\n if (reason === GATE_EVALUATION_ERROR_REASON) {\n return {kind: 'evaluation_error', reason, exit_code: exitCode};\n }\n return {kind: 'uncheckable', passed, uncheckable: true, reason, exit_code: exitCode};\n }\n\n if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'failed', passed, source, exit_code: exitCode};\n }\n\n return {kind: 'unknown', data: gateResult};\n}\n\nexport function toStepDto(step: Step): StepDto {\n return {\n id: step.id,\n job_execution_id: step.jobExecutionId,\n key: step.key,\n name: step.name,\n source_location: toStepSourceLocationDto(step.sourceLocation),\n status: step.status,\n type: step.type,\n config: step.config,\n error: toStepErrorDto(\n step.error,\n step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user',\n ),\n position: step.position,\n current_attempt: step.currentAttempt,\n created_at: step.createdAt.toISOString(),\n updated_at: step.updatedAt.toISOString(),\n };\n}\n\nfunction toStepSourceLocationDto(\n sourceLocation: Step['sourceLocation'],\n): StepDto['source_location'] {\n if (sourceLocation === null) return null;\n return {\n start_line: sourceLocation.startLine,\n end_line: sourceLocation.endLine,\n };\n}\n\nexport function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto {\n return {\n id: attempt.id,\n step_id: attempt.stepId,\n attempt: attempt.attempt,\n execution_order: attempt.executionOrder,\n status: attempt.status,\n exit_code: attempt.exitCode,\n output: attempt.output,\n outputs: attempt.output,\n response: attempt.response,\n error: attempt.error,\n gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),\n restart_feedback: attempt.restartFeedback,\n started_at: attempt.startedAt.toISOString(),\n finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null,\n };\n}\n"],"names":["agentConfigIssueSchema","stepErrorReasonSchema","GATE_EVALUATION_ERROR_REASON","toStepErrorDto","error","category","message","exitCode","signal","undefined","field","source","reason","safeParse","agentConfigIssue","exit_code","success","data","agent_config_issue","fromStepErrorDto","isIntOrNull","value","Number","isInteger","toStepGateResultDto","gateResult","status","kind","passed","uncheckable","toStepDto","step","id","job_execution_id","jobExecutionId","key","name","source_location","toStepSourceLocationDto","sourceLocation","type","config","position","current_attempt","currentAttempt","created_at","createdAt","toISOString","updated_at","updatedAt","start_line","startLine","end_line","endLine","toStepAttemptDto","attempt","step_id","stepId","execution_order","executionOrder","output","outputs","response","gate_result","restart_feedback","restartFeedback","started_at","startedAt","finished_at","finishedAt"],"mappings":"AAAA,SACEA,sBAAsB,EAMtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AAEpF,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,MAAME,UAAU,OAAOF,MAAME,OAAO,KAAK,WAAWF,MAAME,OAAO,GAAG;IACpE,MAAMC,WAAWH,MAAMG,QAAQ;IAC/B,MAAMC,SAAS,OAAOJ,MAAMI,MAAM,KAAK,WAAWJ,MAAMI,MAAM,GAAGC;IACjE,MAAMC,QAAQ,OAAON,MAAMM,KAAK,KAAK,WAAWN,MAAMM,KAAK,GAAGD;IAC9D,MAAME,SAAS,OAAOP,MAAMO,MAAM,KAAK,WAAWP,MAAMO,MAAM,GAAGF;IACjE,MAAMG,SAASX,sBAAsBY,SAAS,CAACT,MAAMQ,MAAM;IAC3D,MAAME,mBAAmBd,uBAAuBa,SAAS,CAACT,MAAMU,gBAAgB;IAChF,OAAO;QACLR;QACA,GAAIC,aAAa,QAAQ,OAAOA,aAAa,WAAW;YAACQ,WAAWR;QAAQ,IAAI,CAAC,CAAC;QAClF,GAAIC,WAAWC,YAAY,CAAC,IAAI;YAACD;QAAM,CAAC;QACxC,GAAII,OAAOI,OAAO,GAAG;YAACJ,QAAQA,OAAOK,IAAI;QAAA,IAAI,CAAC,CAAC;QAC/C,GAAIP,UAAUD,YAAY,CAAC,IAAI;YA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PC,cAAsC;IAEtC,IAAIA,mBAAmB,MAAM,OAAO;IACpC,OAAO;QACLW,YAAYX,eAAeY,SAAS;QACpCC,UAAUb,eAAec,OAAO;IAClC;AACF;AAEA,OAAO,SAASC,iBAAiBC,OAAoB;IACnD,OAAO;QACLvB,IAAIuB,QAAQvB,EAAE;QACdwB,SAASD,QAAQE,MAAM;QACvBF,SAASA,QAAQA,OAAO;QACxBG,iBAAiBH,QAAQI,cAAc;QACvCjC,QAAQ6B,QAAQ7B,MAAM;QACtBX,WAAWwC,QAAQhD,QAAQ;QAC3BqD,QAAQL,QAAQK,MAAM;QACtBC,SAASN,QAAQK,MAAM;QACvBE,UAAUP,QAAQO,QAAQ;QAC1B1D,OAAOmD,QAAQnD,KAAK;QACpB2D,aAAavC,oBAAoB+B,QAAQ9B,UAAU,EAAE8B,QAAQ7B,MAAM;QACnEsC,kBAAkBT,QAAQU,eAAe;QACzCC,YAAYX,QAAQY,SAAS,CAACpB,WAAW;QACzCqB,aAAab,QAAQc,UAAU,GAAGd,QAAQc,UAAU,CAACtB,WAAW,KAAK;IACvE;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/step.ts"],"sourcesContent":["import {\n agentConfigIssueSchema,\n type StepAttemptDetailResponseDto,\n type StepAttemptDto,\n type StepDto,\n type StepErrorCategoryDto,\n type StepErrorDto,\n type StepGateResultDto,\n stepErrorReasonSchema,\n} from '@shipfox/api-workflows-dto';\nimport type {Step, StepAttempt} from '#core/entities/step.js';\nimport {GATE_EVALUATION_ERROR_REASON} from '#core/step-transition/evaluate-gate.js';\nimport {toEvaluationTraceDto} from './evaluation-trace.js';\n\n// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner\n// contract rather than trusting whatever shape the row happens to hold. `category`\n// is not stored on the row; the caller derives it from the step type and passes it\n// in (server-authoritative, never trusted from the runner).\nfunction toStepErrorDto(\n error: Record<string, unknown> | null,\n category: StepErrorCategoryDto,\n): StepErrorDto {\n if (error === null) return null;\n const message = typeof error.message === 'string' ? error.message : '';\n const exitCode = error.exitCode;\n const signal = typeof error.signal === 'string' ? error.signal : undefined;\n const field = typeof error.field === 'string' ? error.field : undefined;\n const source = typeof error.source === 'string' ? error.source : undefined;\n const reason = stepErrorReasonSchema.safeParse(error.reason);\n const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);\n return {\n message,\n ...(exitCode === null || typeof exitCode === 'number' ? {exit_code: exitCode} : {}),\n ...(signal === undefined ? {} : {signal}),\n ...(reason.success ? {reason: reason.data} : {}),\n ...(field === undefined ? {} : {field}),\n ...(source === undefined ? {} : {source}),\n ...(agentConfigIssue.success ? {agent_config_issue: agentConfigIssue.data} : {}),\n category,\n };\n}\n\n// Inverse of toStepErrorDto: reported wire errors land on the domain row in\n// camelCase so the read path renders them back without a special case. `category`\n// is intentionally NOT persisted: the server derives it from the step type on\n// read, so a runner-supplied category is ignored here.\nexport function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null {\n if (!error) return null;\n return {\n message: error.message,\n ...(error.exit_code === null || typeof error.exit_code === 'number'\n ? {exitCode: error.exit_code}\n : {}),\n ...(typeof error.signal === 'string' ? {signal: error.signal} : {}),\n ...(error.reason === undefined ? {} : {reason: error.reason}),\n ...(error.field === undefined ? {} : {field: error.field}),\n ...(error.source === undefined ? {} : {source: error.source}),\n ...(error.agent_config_issue === undefined ? {} : {agentConfigIssue: error.agent_config_issue}),\n };\n}\n\nfunction isIntOrNull(value: unknown): value is number | null {\n return value === null || (typeof value === 'number' && Number.isInteger(value));\n}\n\nfunction toStepGateResultDto(\n gateResult: Record<string, unknown> | null,\n status: string,\n): StepGateResultDto {\n if (gateResult === null) {\n return status === 'running' || status === 'pending' ? {kind: 'not_evaluated'} : {kind: 'none'};\n }\n\n const exitCode = gateResult.exit_code;\n const passed = gateResult.passed;\n const source = gateResult.source;\n const reason = gateResult.reason;\n\n if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'passed', passed, source, exit_code: exitCode};\n }\n\n if (\n passed === false &&\n gateResult.uncheckable === true &&\n typeof reason === 'string' &&\n isIntOrNull(exitCode)\n ) {\n if (reason === GATE_EVALUATION_ERROR_REASON) {\n return {kind: 'evaluation_error', reason, exit_code: exitCode};\n }\n return {kind: 'uncheckable', passed, uncheckable: true, reason, exit_code: exitCode};\n }\n\n if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'failed', passed, source, exit_code: exitCode};\n }\n\n return {kind: 'unknown', data: gateResult};\n}\n\nexport function toStepDto(step: Step): StepDto {\n return {\n id: step.id,\n job_execution_id: step.jobExecutionId,\n key: step.key,\n name: step.name,\n source_location: toStepSourceLocationDto(step.sourceLocation),\n status: step.status,\n status_reason: step.statusReason,\n type: step.type,\n config: step.config,\n evaluation_trace: toEvaluationTraceDto(step.evaluationTrace),\n error: toStepErrorDto(\n step.error,\n step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user',\n ),\n position: step.position,\n current_attempt: step.currentAttempt,\n created_at: step.createdAt.toISOString(),\n updated_at: step.updatedAt.toISOString(),\n };\n}\n\nfunction toStepSourceLocationDto(\n sourceLocation: Step['sourceLocation'],\n): StepDto['source_location'] {\n if (sourceLocation === null) return null;\n return {\n start_line: sourceLocation.startLine,\n end_line: sourceLocation.endLine,\n };\n}\n\nexport function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto {\n return {\n id: attempt.id,\n step_id: attempt.stepId,\n attempt: attempt.attempt,\n execution_order: attempt.executionOrder,\n status: attempt.status,\n exit_code: attempt.exitCode,\n output: attempt.output,\n outputs: attempt.output,\n response: attempt.response,\n error: attempt.error,\n gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),\n restart_feedback: attempt.restartFeedback,\n started_at: attempt.startedAt.toISOString(),\n finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null,\n };\n}\n\nexport function toStepAttemptDetailResponseDto(\n step: Step,\n attempt: StepAttempt,\n): StepAttemptDetailResponseDto {\n return {\n step_id: step.id,\n attempt: attempt.attempt,\n authored_config: step.authoredConfig,\n config: attempt.config,\n evaluation_trace: toEvaluationTraceDto(attempt.evaluationTrace),\n };\n}\n"],"names":["agentConfigIssueSchema","stepErrorReasonSchema","GATE_EVALUATION_ERROR_REASON","toEvaluationTraceDto","toStepErrorDto","error","category","message","exitCode","signal","undefined","field","source","reason","safeParse","agentConfigIssue","exit_code","success","data","agent_config_issue","fromStepErrorDto","isIntOrNull","value","Number","isInteger","toStepGateResultDto","gateResult","status","kind","passed","uncheckable","toStepDto","step","id","job_execution_id","jobExecutionId","key","name","source_location","toStepSourceLocationDto","sourceLocation","status_reason","statusReason","type","config","evaluation_trace","evaluationTrace","position","current_attempt","currentAttempt","created_at","createdAt","toISOString","updated_at","updatedAt","start_line","startLine","end_line","endLine","toStepAttemptDto","attempt","step_id","stepId","execution_order","executionOrder","output","outputs","response","gate_result","restart_feedback","restartFeedback","started_at","startedAt","finished_at","finishedAt","toStepAttemptDetailResponseDto","authored_config","authoredConfig"],"mappings":"AAAA,SACEA,sBAAsB,EAOtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AACpF,SAAQC,oBAAoB,QAAO,wBAAwB;AAE3D,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,MAAME,UAAU,OAAOF,MAAME,OAAO,KAAK,WAAWF,MAAME,OAAO,GAAG;IACpE,MAAMC,WAAWH,MAAMG,QAAQ;IAC/B,MAAMC,SAAS,OAAOJ,MAAMI,MAAM,KAAK,WAAWJ,MAAMI,MAAM,GAAGC;IACjE,MAAMC,QAAQ,OAAON,MAAMM,KAAK,KAAK,WAAWN,MAAMM,KAAK,GAAGD;IAC9D,MAAME,SAAS,OAAOP,MAAMO,MAAM,KAAK,WAAWP,MAAMO,MAAM,GAAGF;IACjE,MAAMG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AE;QAChB2B,SAASA,QAAQA,OAAO;QACxBgB,iBAAiB5C,KAAK6C,cAAc;QACpCjC,QAAQgB,QAAQhB,MAAM;QACtBC,kBAAkB1C,qBAAqByD,QAAQd,eAAe;IAChE;AACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createWorkflowRoutes } from './routes/index.js';
|
|
2
|
-
export { onJobEventDelivered, onJobStepsSettled, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onWorkflowRunAttemptCreated, onWorkflowRunCancelled, } from './subscribers/index.js';
|
|
2
|
+
export { onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled, } from './subscribers/index.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,gCAAgC,EAChC,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,wCAAwC,EACxC,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createWorkflowRoutes } from './routes/index.js';
|
|
2
|
-
export { onJobEventDelivered, onJobStepsSettled, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from './subscribers/index.js';
|
|
2
|
+
export { onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from './subscribers/index.js';
|
|
3
3
|
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/presentation/index.ts"],"sourcesContent":["export {createWorkflowRoutes} from './routes/index.js';\nexport {\n onJobEventDelivered,\n onJobStepsSettled,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from './subscribers/index.js';\n"],"names":["createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onWorkflowRunAttemptCreated","onWorkflowRunCancelled"],"mappings":"AAAA,SAAQA,oBAAoB,QAAO,oBAAoB;AACvD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBAAyB"}
|
|
1
|
+
{"version":3,"sources":["../../src/presentation/index.ts"],"sourcesContent":["export {createWorkflowRoutes} from './routes/index.js';\nexport {\n onJobEventDelivered,\n onJobStepsSettled,\n onJobTerminatedFailureAnnotation,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onStepAttemptTerminatedFailureAnnotation,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from './subscribers/index.js';\n"],"names":["createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onJobTerminatedFailureAnnotation","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onStepAttemptTerminatedFailureAnnotation","onWorkflowRunAttemptCreated","onWorkflowRunCancelled"],"mappings":"AAAA,SAAQA,oBAAoB,QAAO,oBAAoB;AACvD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,gCAAgC,EAChCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,wCAAwC,EACxCC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-step-attempt-detail.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/get-step-attempt-detail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAQjF,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,oBAAoB,mDAwBvE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { stepAttemptDetailResponseSchema } from '@shipfox/api-workflows-dto';
|
|
2
|
+
import { ClientError, defineRoute } from '@shipfox/node-fastify';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { getStepAttemptDetail } from '#db/index.js';
|
|
5
|
+
import { toStepAttemptDetailResponseDto } from '#presentation/dto/step.js';
|
|
6
|
+
import { requireAccessibleRun } from './require-accessible-run.js';
|
|
7
|
+
export function getStepAttemptDetailRoute(projects) {
|
|
8
|
+
return defineRoute({
|
|
9
|
+
method: 'GET',
|
|
10
|
+
path: '/steps/:stepId/attempts/:attempt',
|
|
11
|
+
description: 'Get troubleshooting details for one step attempt',
|
|
12
|
+
schema: {
|
|
13
|
+
params: z.object({
|
|
14
|
+
stepId: z.string().uuid(),
|
|
15
|
+
attempt: z.coerce.number().int().positive()
|
|
16
|
+
}),
|
|
17
|
+
response: {
|
|
18
|
+
200: stepAttemptDetailResponseSchema
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
handler: async (request)=>{
|
|
22
|
+
const detail = await getStepAttemptDetail(request.params);
|
|
23
|
+
if (!detail) {
|
|
24
|
+
throw new ClientError('Step attempt not found', 'not-found', {
|
|
25
|
+
status: 404
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
await requireAccessibleRun({
|
|
29
|
+
request,
|
|
30
|
+
id: detail.workflowRunId,
|
|
31
|
+
projects
|
|
32
|
+
});
|
|
33
|
+
return toStepAttemptDetailResponseDto(detail.step, detail.attempt);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=get-step-attempt-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/routes/get-step-attempt-detail.ts"],"sourcesContent":["import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {stepAttemptDetailResponseSchema} from '@shipfox/api-workflows-dto';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {z} from 'zod';\nimport {getStepAttemptDetail} from '#db/index.js';\nimport {toStepAttemptDetailResponseDto} from '#presentation/dto/step.js';\nimport {requireAccessibleRun} from './require-accessible-run.js';\n\nexport function getStepAttemptDetailRoute(projects: ProjectsModuleClient) {\n return defineRoute({\n method: 'GET',\n path: '/steps/:stepId/attempts/:attempt',\n description: 'Get troubleshooting details for one step attempt',\n schema: {\n params: z.object({\n stepId: z.string().uuid(),\n attempt: z.coerce.number().int().positive(),\n }),\n response: {\n 200: stepAttemptDetailResponseSchema,\n },\n },\n handler: async (request) => {\n const detail = await getStepAttemptDetail(request.params);\n if (!detail) {\n throw new ClientError('Step attempt not found', 'not-found', {status: 404});\n }\n\n await requireAccessibleRun({request, id: detail.workflowRunId, projects});\n return toStepAttemptDetailResponseDto(detail.step, detail.attempt);\n },\n });\n}\n"],"names":["stepAttemptDetailResponseSchema","ClientError","defineRoute","z","getStepAttemptDetail","toStepAttemptDetailResponseDto","requireAccessibleRun","getStepAttemptDetailRoute","projects","method","path","description","schema","params","object","stepId","string","uuid","attempt","coerce","number","int","positive","response","handler","request","detail","status","id","workflowRunId","step"],"mappings":"AACA,SAAQA,+BAA+B,QAAO,6BAA6B;AAC3E,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,CAAC,QAAO,MAAM;AACtB,SAAQC,oBAAoB,QAAO,eAAe;AAClD,SAAQC,8BAA8B,QAAO,4BAA4B;AACzE,SAAQC,oBAAoB,QAAO,8BAA8B;AAEjE,OAAO,SAASC,0BAA0BC,QAA8B;IACtE,OAAON,YAAY;QACjBO,QAAQ;QACRC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACNC,QAAQV,EAAEW,MAAM,CAAC;gBACfC,QAAQZ,EAAEa,MAAM,GAAGC,IAAI;gBACvBC,SAASf,EAAEgB,MAAM,CAACC,MAAM,GAAGC,GAAG,GAAGC,QAAQ;YAC3C;YACAC,UAAU;gBACR,KAAKvB;YACP;QACF;QACAwB,SAAS,OAAOC;YACd,MAAMC,SAAS,MAAMtB,qBAAqBqB,QAAQZ,MAAM;YACxD,IAAI,CAACa,QAAQ;gBACX,MAAM,IAAIzB,YAAY,0BAA0B,aAAa;oBAAC0B,QAAQ;gBAAG;YAC3E;YAEA,MAAMrB,qBAAqB;gBAACmB;gBAASG,IAAIF,OAAOG,aAAa;gBAAErB;YAAQ;YACvE,OAAOH,+BAA+BqB,OAAOI,IAAI,EAAEJ,OAAOR,OAAO;QACnE;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,uCAAuC,CAAC;AACxF,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAEhF,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AAC9E,OAAO,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AAE,2BAA2B,CAAC;CACzC,CAAC;AAEF,KAAK,sBAAsB,GAAG,IAAI,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;AAEvE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,sBAAsB,GAAG,UAAU,CAiBrF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,EAAE,CAiB/E"}
|
|
@@ -4,6 +4,7 @@ import { cancelRunRoute } from './cancel-run.js';
|
|
|
4
4
|
import { createCheckoutTokenRoute } from './checkout-token.js';
|
|
5
5
|
import { getRunRoute } from './get-run.js';
|
|
6
6
|
import { getRunAggregatesRoute } from './get-run-aggregates.js';
|
|
7
|
+
import { getStepAttemptDetailRoute } from './get-step-attempt-detail.js';
|
|
7
8
|
import { createGetStepSecretsRoute } from './get-step-secrets.js';
|
|
8
9
|
import { listRunAttemptsRoute } from './list-run-attempts.js';
|
|
9
10
|
import { listRunsRoute } from './list-runs.js';
|
|
@@ -38,6 +39,7 @@ export function createWorkflowRoutes(params) {
|
|
|
38
39
|
getRunAggregatesRoute(params.projects),
|
|
39
40
|
listRunAttemptsRoute(params.projects),
|
|
40
41
|
getRunRoute(params.projects),
|
|
42
|
+
getStepAttemptDetailRoute(params.projects),
|
|
41
43
|
cancelRunRoute(params.projects),
|
|
42
44
|
rerunRunRoute(params.projects, params.workspaces)
|
|
43
45
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/routes/index.ts"],"sourcesContent":["import type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport {AUTH_LEASED_JOB, AUTH_USER} from '@shipfox/api-auth-context';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport type {RouteGroup} from '@shipfox/node-fastify';\nimport {createAgentRuntimeConfigRoute} from './agent-runtime-config.js';\nimport {cancelRunRoute} from './cancel-run.js';\nimport {createCheckoutTokenRoute} from './checkout-token.js';\nimport {getRunRoute} from './get-run.js';\nimport {getRunAggregatesRoute} from './get-run-aggregates.js';\nimport {createGetStepSecretsRoute} from './get-step-secrets.js';\nimport {listRunAttemptsRoute} from './list-run-attempts.js';\nimport {listRunsRoute} from './list-runs.js';\nimport {createNextStepRoute} from './next-step.js';\nimport {createReportStepRoute} from './report-step.js';\nimport {rerunRunRoute} from './rerun-run.js';\n\ntype WorkflowRouteClients = {\n agent: AgentInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n};\n\ntype LeaseTokenRouteClients = Omit<WorkflowRouteClients, 'workspaces'>;\n\nexport function createLeaseTokenRouteGroup(params: LeaseTokenRouteClients): RouteGroup {\n return {\n // The lease token names the job, so the path carries no job id (\"current\").\n prefix: '/runs/jobs/current',\n auth: AUTH_LEASED_JOB,\n routes: [\n createNextStepRoute(params),\n createReportStepRoute(params.runners),\n createCheckoutTokenRoute({\n integrations: params.integrations,\n projects: params.projects,\n runners: params.runners,\n }),\n createAgentRuntimeConfigRoute(params),\n createGetStepSecretsRoute(params.runners, params.secrets),\n ],\n };\n}\n\nexport function createWorkflowRoutes(params: WorkflowRouteClients): RouteGroup[] {\n return [\n {\n prefix: '/workflows/runs',\n auth: AUTH_USER,\n routes: [\n listRunsRoute(params.projects),\n getRunAggregatesRoute(params.projects),\n listRunAttemptsRoute(params.projects),\n getRunRoute(params.projects),\n cancelRunRoute(params.projects),\n rerunRunRoute(params.projects, params.workspaces),\n ],\n },\n createLeaseTokenRouteGroup(params),\n ];\n}\n"],"names":["AUTH_LEASED_JOB","AUTH_USER","createAgentRuntimeConfigRoute","cancelRunRoute","createCheckoutTokenRoute","getRunRoute","getRunAggregatesRoute","createGetStepSecretsRoute","listRunAttemptsRoute","listRunsRoute","createNextStepRoute","createReportStepRoute","rerunRunRoute","createLeaseTokenRouteGroup","params","prefix","auth","routes","runners","integrations","projects","secrets","createWorkflowRoutes","workspaces"],"mappings":"AAEA,SAAQA,eAAe,EAAEC,SAAS,QAAO,4BAA4B;AAQrE,SAAQC,6BAA6B,QAAO,4BAA4B;AACxE,SAAQC,cAAc,QAAO,kBAAkB;AAC/C,SAAQC,wBAAwB,QAAO,sBAAsB;AAC7D,SAAQC,WAAW,QAAO,eAAe;AACzC,SAAQC,qBAAqB,QAAO,0BAA0B;AAC9D,SAAQC,yBAAyB,QAAO,wBAAwB;AAChE,SAAQC,oBAAoB,QAAO,yBAAyB;AAC5D,SAAQC,aAAa,QAAO,iBAAiB;AAC7C,SAAQC,mBAAmB,QAAO,iBAAiB;AACnD,SAAQC,qBAAqB,QAAO,mBAAmB;AACvD,SAAQC,aAAa,QAAO,iBAAiB;AAe7C,OAAO,SAASC,2BAA2BC,MAA8B;IACvE,OAAO;QACL,4EAA4E;QAC5EC,QAAQ;QACRC,
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/routes/index.ts"],"sourcesContent":["import type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport {AUTH_LEASED_JOB, AUTH_USER} from '@shipfox/api-auth-context';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport type {RouteGroup} from '@shipfox/node-fastify';\nimport {createAgentRuntimeConfigRoute} from './agent-runtime-config.js';\nimport {cancelRunRoute} from './cancel-run.js';\nimport {createCheckoutTokenRoute} from './checkout-token.js';\nimport {getRunRoute} from './get-run.js';\nimport {getRunAggregatesRoute} from './get-run-aggregates.js';\nimport {getStepAttemptDetailRoute} from './get-step-attempt-detail.js';\nimport {createGetStepSecretsRoute} from './get-step-secrets.js';\nimport {listRunAttemptsRoute} from './list-run-attempts.js';\nimport {listRunsRoute} from './list-runs.js';\nimport {createNextStepRoute} from './next-step.js';\nimport {createReportStepRoute} from './report-step.js';\nimport {rerunRunRoute} from './rerun-run.js';\n\ntype WorkflowRouteClients = {\n agent: AgentInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n};\n\ntype LeaseTokenRouteClients = Omit<WorkflowRouteClients, 'workspaces'>;\n\nexport function createLeaseTokenRouteGroup(params: LeaseTokenRouteClients): RouteGroup {\n return {\n // The lease token names the job, so the path carries no job id (\"current\").\n prefix: '/runs/jobs/current',\n auth: AUTH_LEASED_JOB,\n routes: [\n createNextStepRoute(params),\n createReportStepRoute(params.runners),\n createCheckoutTokenRoute({\n integrations: params.integrations,\n projects: params.projects,\n runners: params.runners,\n }),\n createAgentRuntimeConfigRoute(params),\n createGetStepSecretsRoute(params.runners, params.secrets),\n ],\n };\n}\n\nexport function createWorkflowRoutes(params: WorkflowRouteClients): RouteGroup[] {\n return [\n {\n prefix: '/workflows/runs',\n auth: AUTH_USER,\n routes: [\n listRunsRoute(params.projects),\n getRunAggregatesRoute(params.projects),\n listRunAttemptsRoute(params.projects),\n getRunRoute(params.projects),\n getStepAttemptDetailRoute(params.projects),\n cancelRunRoute(params.projects),\n rerunRunRoute(params.projects, params.workspaces),\n ],\n },\n createLeaseTokenRouteGroup(params),\n ];\n}\n"],"names":["AUTH_LEASED_JOB","AUTH_USER","createAgentRuntimeConfigRoute","cancelRunRoute","createCheckoutTokenRoute","getRunRoute","getRunAggregatesRoute","getStepAttemptDetailRoute","createGetStepSecretsRoute","listRunAttemptsRoute","listRunsRoute","createNextStepRoute","createReportStepRoute","rerunRunRoute","createLeaseTokenRouteGroup","params","prefix","auth","routes","runners","integrations","projects","secrets","createWorkflowRoutes","workspaces"],"mappings":"AAEA,SAAQA,eAAe,EAAEC,SAAS,QAAO,4BAA4B;AAQrE,SAAQC,6BAA6B,QAAO,4BAA4B;AACxE,SAAQC,cAAc,QAAO,kBAAkB;AAC/C,SAAQC,wBAAwB,QAAO,sBAAsB;AAC7D,SAAQC,WAAW,QAAO,eAAe;AACzC,SAAQC,qBAAqB,QAAO,0BAA0B;AAC9D,SAAQC,yBAAyB,QAAO,+BAA+B;AACvE,SAAQC,yBAAyB,QAAO,wBAAwB;AAChE,SAAQC,oBAAoB,QAAO,yBAAyB;AAC5D,SAAQC,aAAa,QAAO,iBAAiB;AAC7C,SAAQC,mBAAmB,QAAO,iBAAiB;AACnD,SAAQC,qBAAqB,QAAO,mBAAmB;AACvD,SAAQC,aAAa,QAAO,iBAAiB;AAe7C,OAAO,SAASC,2BAA2BC,MAA8B;IACvE,OAAO;QACL,4EAA4E;QAC5EC,QAAQ;QACRC,MAAMjB;QACNkB,QAAQ;YACNP,oBAAoBI;YACpBH,sBAAsBG,OAAOI,OAAO;YACpCf,yBAAyB;gBACvBgB,cAAcL,OAAOK,YAAY;gBACjCC,UAAUN,OAAOM,QAAQ;gBACzBF,SAASJ,OAAOI,OAAO;YACzB;YACAjB,8BAA8Ba;YAC9BP,0BAA0BO,OAAOI,OAAO,EAAEJ,OAAOO,OAAO;SACzD;IACH;AACF;AAEA,OAAO,SAASC,qBAAqBR,MAA4B;IAC/D,OAAO;QACL;YACEC,QAAQ;YACRC,MAAMhB;YACNiB,QAAQ;gBACNR,cAAcK,OAAOM,QAAQ;gBAC7Bf,sBAAsBS,OAAOM,QAAQ;gBACrCZ,qBAAqBM,OAAOM,QAAQ;gBACpChB,YAAYU,OAAOM,QAAQ;gBAC3Bd,0BAA0BQ,OAAOM,QAAQ;gBACzClB,eAAeY,OAAOM,QAAQ;gBAC9BR,cAAcE,OAAOM,QAAQ,EAAEN,OAAOS,UAAU;aACjD;QACH;QACAV,2BAA2BC;KAC5B;AACH"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { onJobTerminatedFailureAnnotation, onStepAttemptTerminatedFailureAnnotation, } from './on-failure-annotations.js';
|
|
1
2
|
export { onJobEventDelivered } from './on-job-event-delivered.js';
|
|
2
3
|
export { onJobStepsSettled } from './on-job-steps-settled.js';
|
|
3
4
|
export { onRunnerJobClaimed } from './on-runner-job-claimed.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/subscribers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,2BAA2B,EAAC,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/subscribers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,2BAA2B,EAAC,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { onJobTerminatedFailureAnnotation, onStepAttemptTerminatedFailureAnnotation } from './on-failure-annotations.js';
|
|
1
2
|
export { onJobEventDelivered } from './on-job-event-delivered.js';
|
|
2
3
|
export { onJobStepsSettled } from './on-job-steps-settled.js';
|
|
3
4
|
export { onRunnerJobClaimed } from './on-runner-job-claimed.js';
|