Kaizen
Browse modulesFormsforms/serverClasses

Class: FormStepService

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

Service for managing draft FormSteps rows on an unpublished FormSchemaVersion. All mutations are guarded by assertVersionUnpublished (inherited from BaseFormService) — once a version is published, the only way to change its steps is to create a new draft version.

Extends

Constructors

Constructor

new FormStepService(deps: FormFeatureDeps): FormStepService;

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

Parameters

ParameterType
depsFormFeatureDeps

Returns

FormStepService

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(formSchemaVersionId: string, input: {
  description?: string | null;
  fields: {
     additionalInfo?: {
        body?: string;
        title?: string;
     };
     adoptionStatement?: string;
     allowedFonts?: string[];
     asset?: {
        alt?: string;
        fileId?: string;
        filename?: string;
        mimeType?: string;
        url?: string;
     };
     dataSource?: string;
     defaultValue?:   | string
        | {
        from: string;
        to: string | null;
      };
     description?: string;
     fields?: {
        additionalInfo?: {
           body?: string;
           title?: string;
        };
        adoptionStatement?: string;
        allowedFonts?: string[];
        asset?: {
           alt?: string;
           fileId?: string;
           filename?: string;
           mimeType?: string;
           url?: string;
        };
        dataSource?: string;
        defaultValue?:   | string
           | {
           from: string;
           to: string | null;
         };
        description?: string;
        format?: string;
        label: string;
        maxDate?: string;
        maxFiles?: number;
        maxLength?: number;
        minDate?: string;
        name: string;
        options?: (
           | string
           | {
           description?: ... | ...;
           value: string;
        })[];
        placeholder?: string;
        prefillFrom?: string;
        required: boolean;
        showRange?: boolean;
        showTime?: boolean;
        signatureMode?: "typed" | "drawn";
        timezone?: string;
        type:   | "number"
           | "date"
           | "file"
           | "email"
           | "url"
           | "select"
           | "text"
           | "checkbox"
           | "textarea"
           | "phone"
           | "radio-group"
           | "multiselect"
           | "field-array"
           | "image"
           | "file-download"
           | "section-header"
           | "section-unset"
           | "signature"
           | "signature-adopted";
     }[];
     format?: string;
     label: string;
     maxDate?: string;
     maxFiles?: number;
     maxLength?: number;
     maxRows?: number;
     minDate?: string;
     minRows?: number;
     name: string;
     options?: (
        | string
        | {
        description?: string;
        value: string;
     })[];
     placeholder?: string;
     prefillFrom?: string;
     required: boolean;
     showRange?: boolean;
     showTime?: boolean;
     signatureMode?: "typed" | "drawn";
     timezone?: string;
     type:   | "number"
        | "date"
        | "file"
        | "email"
        | "url"
        | "select"
        | "text"
        | "checkbox"
        | "textarea"
        | "phone"
        | "radio-group"
        | "multiselect"
        | "field-array"
        | "image"
        | "file-download"
        | "section-header"
        | "section-unset"
        | "signature"
        | "signature-adopted";
  }[];
  key: string;
  label?: string | null;
}): Promise<{
  description: string | null;
  fields: {
     additionalInfo?: {
        body?: string;
        title?: string;
     };
     adoptionStatement?: string;
     allowedFonts?: string[];
     asset?: {
        alt?: string;
        fileId?: string;
        filename?: string;
        mimeType?: string;
        url?: string;
     };
     dataSource?: string;
     defaultValue?:   | string
        | {
        from: string;
        to: string | null;
      };
     description?: string;
     fields?: {
        additionalInfo?: {
           body?: string;
           title?: string;
        };
        adoptionStatement?: string;
        allowedFonts?: string[];
        asset?: {
           alt?: string;
           fileId?: string;
           filename?: string;
           mimeType?: string;
           url?: string;
        };
        dataSource?: string;
        defaultValue?:   | string
           | {
           from: string;
           to: string | null;
         };
        description?: string;
        format?: string;
        label: string;
        maxDate?: string;
        maxFiles?: number;
        maxLength?: number;
        minDate?: string;
        name: string;
        options?: (
           | string
           | {
           description?: ...;
           value: ...;
        })[];
        placeholder?: string;
        prefillFrom?: string;
        required: boolean;
        showRange?: boolean;
        showTime?: boolean;
        signatureMode?: "typed" | "drawn";
        timezone?: string;
        type:   | "number"
           | "date"
           | "file"
           | "email"
           | "url"
           | "select"
           | "text"
           | "checkbox"
           | "textarea"
           | "phone"
           | "radio-group"
           | "multiselect"
           | "field-array"
           | "image"
           | "file-download"
           | "section-header"
           | "section-unset"
           | "signature"
           | "signature-adopted";
     }[];
     format?: string;
     label: string;
     maxDate?: string;
     maxFiles?: number;
     maxLength?: number;
     maxRows?: number;
     minDate?: string;
     minRows?: number;
     name: string;
     options?: (
        | string
        | {
        description?: string;
        value: string;
     })[];
     placeholder?: string;
     prefillFrom?: string;
     required: boolean;
     showRange?: boolean;
     showTime?: boolean;
     signatureMode?: "typed" | "drawn";
     timezone?: string;
     type:   | "number"
        | "date"
        | "file"
        | "email"
        | "url"
        | "select"
        | "text"
        | "checkbox"
        | "textarea"
        | "phone"
        | "radio-group"
        | "multiselect"
        | "field-array"
        | "image"
        | "file-download"
        | "section-header"
        | "section-unset"
        | "signature"
        | "signature-adopted";
  }[];
  formSchemaVersionId: string;
  id: string;
  key: string;
  label: string | null;
}>;

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

Parameters

ParameterType
formSchemaVersionIdstring
input{ description?: string | null; fields: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; fields?: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; minDate?: string; name: string; options?: ( | string | { description?: ... | ...; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; maxRows?: number; minDate?: string; minRows?: number; name: string; options?: ( | string | { description?: string; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; key: string; label?: string | null; }
input.description?string | null
input.fields{ additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; fields?: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; minDate?: string; name: string; options?: ( | string | { description?: ... | ...; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; maxRows?: number; minDate?: string; minRows?: number; name: string; options?: ( | string | { description?: string; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]
input.keystring
input.label?string | null

Returns

Promise<{ description: string | null; fields: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; fields?: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; minDate?: string; name: string; options?: ( | string | { description?: ...; value: ...; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; maxRows?: number; minDate?: string; minRows?: number; name: string; options?: ( | string | { description?: string; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; formSchemaVersionId: string; id: string; key: string; label: string | null; }>


listByVersion()

listByVersion(formSchemaVersionId: string): Promise<{
  description: string | null;
  fields: {
     additionalInfo?: {
        body?: string;
        title?: string;
     };
     adoptionStatement?: string;
     allowedFonts?: string[];
     asset?: {
        alt?: string;
        fileId?: string;
        filename?: string;
        mimeType?: string;
        url?: string;
     };
     dataSource?: string;
     defaultValue?:   | string
        | {
        from: string;
        to: string | null;
      };
     description?: string;
     fields?: {
        additionalInfo?: {
           body?: ... | ...;
           title?: ... | ...;
        };
        adoptionStatement?: string;
        allowedFonts?: string[];
        asset?: {
           alt?: ... | ...;
           fileId?: ... | ...;
           filename?: ... | ...;
           mimeType?: ... | ...;
           url?: ... | ...;
        };
        dataSource?: string;
        defaultValue?:   | string
           | {
           from: string;
           to: ... | ...;
         };
        description?: string;
        format?: string;
        label: string;
        maxDate?: string;
        maxFiles?: number;
        maxLength?: number;
        minDate?: string;
        name: string;
        options?: (... | ...)[];
        placeholder?: string;
        prefillFrom?: string;
        required: boolean;
        showRange?: boolean;
        showTime?: boolean;
        signatureMode?: "typed" | "drawn";
        timezone?: string;
        type:   | "number"
           | "date"
           | "file"
           | "email"
           | "url"
           | "select"
           | "text"
           | "checkbox"
           | "textarea"
           | "phone"
           | "radio-group"
           | "multiselect"
           | "field-array"
           | "image"
           | "file-download"
           | "section-header"
           | "section-unset"
           | "signature"
           | "signature-adopted";
     }[];
     format?: string;
     label: string;
     maxDate?: string;
     maxFiles?: number;
     maxLength?: number;
     maxRows?: number;
     minDate?: string;
     minRows?: number;
     name: string;
     options?: (
        | string
        | {
        description?: string;
        value: string;
     })[];
     placeholder?: string;
     prefillFrom?: string;
     required: boolean;
     showRange?: boolean;
     showTime?: boolean;
     signatureMode?: "typed" | "drawn";
     timezone?: string;
     type:   | "number"
        | "date"
        | "file"
        | "email"
        | "url"
        | "select"
        | "text"
        | "checkbox"
        | "textarea"
        | "phone"
        | "radio-group"
        | "multiselect"
        | "field-array"
        | "image"
        | "file-download"
        | "section-header"
        | "section-unset"
        | "signature"
        | "signature-adopted";
  }[];
  formSchemaVersionId: string;
  id: string;
  key: string;
  label: string | null;
}[]>;

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

Parameters

ParameterType
formSchemaVersionIdstring

Returns

Promise<{ description: string | null; fields: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; fields?: { additionalInfo?: { body?: ... | ...; title?: ... | ...; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: ... | ...; fileId?: ... | ...; filename?: ... | ...; mimeType?: ... | ...; url?: ... | ...; }; dataSource?: string; defaultValue?: | string | { from: string; to: ... | ...; }; description?: string; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; minDate?: string; name: string; options?: (... | ...)[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; maxRows?: number; minDate?: string; minRows?: number; name: string; options?: ( | string | { description?: string; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; formSchemaVersionId: string; id: string; key: string; label: string | null; }[]>


softDelete()

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

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

Soft-delete a step and cascade-delete any transitions touching it (in either direction). Cascading keeps the DAG consistent — leaving a transition pointing at a deleted step would surface as an unreachable_step or dangling reference at publish time.

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<FormStepInput>): Promise<{
  description: string | null;
  fields: {
     additionalInfo?: {
        body?: string;
        title?: string;
     };
     adoptionStatement?: string;
     allowedFonts?: string[];
     asset?: {
        alt?: string;
        fileId?: string;
        filename?: string;
        mimeType?: string;
        url?: string;
     };
     dataSource?: string;
     defaultValue?:   | string
        | {
        from: string;
        to: string | null;
      };
     description?: string;
     fields?: {
        additionalInfo?: {
           body?: string;
           title?: string;
        };
        adoptionStatement?: string;
        allowedFonts?: string[];
        asset?: {
           alt?: string;
           fileId?: string;
           filename?: string;
           mimeType?: string;
           url?: string;
        };
        dataSource?: string;
        defaultValue?:   | string
           | {
           from: string;
           to: string | null;
         };
        description?: string;
        format?: string;
        label: string;
        maxDate?: string;
        maxFiles?: number;
        maxLength?: number;
        minDate?: string;
        name: string;
        options?: (
           | string
           | {
           description?: ...;
           value: ...;
        })[];
        placeholder?: string;
        prefillFrom?: string;
        required: boolean;
        showRange?: boolean;
        showTime?: boolean;
        signatureMode?: "typed" | "drawn";
        timezone?: string;
        type:   | "number"
           | "date"
           | "file"
           | "email"
           | "url"
           | "select"
           | "text"
           | "checkbox"
           | "textarea"
           | "phone"
           | "radio-group"
           | "multiselect"
           | "field-array"
           | "image"
           | "file-download"
           | "section-header"
           | "section-unset"
           | "signature"
           | "signature-adopted";
     }[];
     format?: string;
     label: string;
     maxDate?: string;
     maxFiles?: number;
     maxLength?: number;
     maxRows?: number;
     minDate?: string;
     minRows?: number;
     name: string;
     options?: (
        | string
        | {
        description?: string;
        value: string;
     })[];
     placeholder?: string;
     prefillFrom?: string;
     required: boolean;
     showRange?: boolean;
     showTime?: boolean;
     signatureMode?: "typed" | "drawn";
     timezone?: string;
     type:   | "number"
        | "date"
        | "file"
        | "email"
        | "url"
        | "select"
        | "text"
        | "checkbox"
        | "textarea"
        | "phone"
        | "radio-group"
        | "multiselect"
        | "field-array"
        | "image"
        | "file-download"
        | "section-header"
        | "section-unset"
        | "signature"
        | "signature-adopted";
  }[];
  formSchemaVersionId: string;
  id: string;
  key: string;
  label: string | null;
}>;

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

Parameters

ParameterType
idstring
patchPartial<FormStepInput>

Returns

Promise<{ description: string | null; fields: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; fields?: { additionalInfo?: { body?: string; title?: string; }; adoptionStatement?: string; allowedFonts?: string[]; asset?: { alt?: string; fileId?: string; filename?: string; mimeType?: string; url?: string; }; dataSource?: string; defaultValue?: | string | { from: string; to: string | null; }; description?: string; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; minDate?: string; name: string; options?: ( | string | { description?: ...; value: ...; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; format?: string; label: string; maxDate?: string; maxFiles?: number; maxLength?: number; maxRows?: number; minDate?: string; minRows?: number; name: string; options?: ( | string | { description?: string; value: string; })[]; placeholder?: string; prefillFrom?: string; required: boolean; showRange?: boolean; showTime?: boolean; signatureMode?: "typed" | "drawn"; timezone?: string; type: | "number" | "date" | "file" | "email" | "url" | "select" | "text" | "checkbox" | "textarea" | "phone" | "radio-group" | "multiselect" | "field-array" | "image" | "file-download" | "section-header" | "section-unset" | "signature" | "signature-adopted"; }[]; formSchemaVersionId: string; id: string; key: string; label: string | null; }>

On this page