Kaizen
Browse modulesFormsforms/serverClasses

Class: FormStepTransitionService

Defined in: server/forms/form-step-transition-service.ts:25

Service for managing draft FormStepTransitions rows. All mutations are guarded so they only succeed against unpublished versions — once published, the DAG is frozen and editors must create a new draft version to change it.

Extends

Constructors

Constructor

new FormStepTransitionService(deps: FormFeatureDeps): FormStepTransitionService;

Defined in: server/forms/base-form-service.ts:5

Parameters

ParameterType
depsFormFeatureDeps

Returns

FormStepTransitionService

Inherited from

BaseFormService.constructor

Properties

deps

protected readonly deps: FormFeatureDeps;

Defined in: server/forms/base-form-service.ts:5

Inherited from

BaseFormService.deps

Accessors

actorId

Get Signature

get protected actorId(): string | null;

Defined in: server/forms/base-form-service.ts:7

Returns

string | null

Inherited from

BaseFormService.actorId

Methods

assertVersionUnpublished()

protected assertVersionUnpublished(versionId: string): Promise<void>;

Defined in: server/forms/base-form-service.ts:28

Guard that rejects mutations against a published FormSchemaVersion. Once a version is published the DAG (steps, transitions, entry-step key) is frozen — editors must spawn a fresh draft version with FormSchemaService.createDraftVersion to make further changes.

Centralised here so step / transition / future services share one invariant and one error message.

Parameters

ParameterType
versionIdstring

Returns

Promise<void>

Inherited from

BaseFormService.assertVersionUnpublished


create()

create(fromStepId: string, input: FormStepTransitionServiceInput): Promise<{
  fromStepId: string;
  id: string;
  label: string | null;
  priority: number;
  ruleId: string | null;
  ruleVersionId: string | null;
  toStepId: string;
}>;

Defined in: server/forms/form-step-transition-service.ts:26

Parameters

ParameterType
fromStepIdstring
inputFormStepTransitionServiceInput

Returns

Promise<{ fromStepId: string; id: string; label: string | null; priority: number; ruleId: string | null; ruleVersionId: string | null; toStepId: string; }>


listByFromStep()

listByFromStep(fromStepId: string): Promise<{
  fromStepId: string;
  id: string;
  label: string | null;
  priority: number;
  ruleId: string | null;
  ruleVersionId: string | null;
  toStepId: string;
}[]>;

Defined in: server/forms/form-step-transition-service.ts:52

Parameters

ParameterType
fromStepIdstring

Returns

Promise<{ fromStepId: string; id: string; label: string | null; priority: number; ruleId: string | null; ruleVersionId: string | null; toStepId: string; }[]>


listByVersion()

listByVersion(formSchemaVersionId: string): Promise<{
  fromStepId: string;
  id: string;
  label: string | null;
  priority: number;
  ruleId: string | null;
  ruleVersionId: string | null;
  toStepId: string;
}[]>;

Defined in: server/forms/form-step-transition-service.ts:42

Parameters

ParameterType
formSchemaVersionIdstring

Returns

Promise<{ fromStepId: string; id: string; label: string | null; priority: number; ruleId: string | null; ruleVersionId: string | null; toStepId: string; }[]>


reorder()

reorder(fromStepId: string, orderedTransitionIds: string[]): Promise<void>;

Defined in: server/forms/form-step-transition-service.ts:95

Bulk-update transition priorities for a single fromStep so they match orderedTransitionIds. The DB enforces @@unique([fromStepId, priority]), which means a naive in-place shuffle would fail mid-way. We do it in two phases inside one transaction: first push every existing row to a negative priority (always free), then assign target priorities in input order.

Parameters

ParameterType
fromStepIdstring
orderedTransitionIdsstring[]

Returns

Promise<void>


softDelete()

softDelete(id: string): Promise<void>;

Defined in: server/forms/form-step-transition-service.ts:77

Parameters

ParameterType
idstring

Returns

Promise<void>


transaction()

protected transaction<T>(fn: (deps: FormFeatureDeps) => Promise<T>): Promise<T>;

Defined in: server/forms/base-form-service.ts:11

Type Parameters

Type Parameter
T

Parameters

ParameterType
fn(deps: FormFeatureDeps) => Promise<T>

Returns

Promise<T>

Inherited from

BaseFormService.transaction


update()

update(id: string, patch: Partial<FormStepTransitionServiceInput>): Promise<{
  fromStepId: string;
  id: string;
  label: string | null;
  priority: number;
  ruleId: string | null;
  ruleVersionId: string | null;
  toStepId: string;
}>;

Defined in: server/forms/form-step-transition-service.ts:58

Parameters

ParameterType
idstring
patchPartial<FormStepTransitionServiceInput>

Returns

Promise<{ fromStepId: string; id: string; label: string | null; priority: number; ruleId: string | null; ruleVersionId: string | null; toStepId: string; }>

On this page