Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/services/stage-transition

lib/services/stage-transition

Provides atomic stage transition management for import jobs.

This service ensures that stage transitions and job queuing happen atomically to prevent race conditions and duplicate job creation. It manages the entire transition lifecycle including validation, queuing, and state tracking.

Key responsibilities:

  • Atomic stage transition processing
  • Stage transition validation
  • Centralized job queuing logic.

Classes

StageTransitionService

Service to handle stage transitions atomically.

Constructors

Constructor

new StageTransitionService(): StageTransitionService

Returns

StageTransitionService

Methods

validateStageTransition()

static validateStageTransition(fromStage, toStage): boolean

Validate stage transition.

Parameters
fromStage

string

toStage

string

Returns

boolean

processStageTransition()

static processStageTransition(payload, job, previousJob): Promise<StageTransitionResult>

Process stage transition and queue appropriate jobs atomically.

Parameters
payload

BasePayload

job

ImportJob

previousJob

ImportJob | undefined

Returns

Promise<StageTransitionResult>

Interfaces

StageTransitionResult

Properties

success

success: boolean

jobQueued?

optional jobQueued: boolean

queuedJobType?

optional queuedJobType: string

error?

optional error: string

Last updated on