Kaizen
Browse modulesFormsforms/sharedFunctions

Function: buildNextStepResolver()

function buildNextStepResolver(__namedParameters: {
  evaluateConditionLogicNode: (node: ConditionLogicNode) => boolean;
  steps: {
     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;
  }[];
  transitions: FormStepTransitionWithKey[];
}): (fromKey: string) => string | null;

Defined in: shared/forms/dag.ts:344

Compose a getNextStepFromKey resolver for getStepCountToLastStep out of a fully-resolved transition list and a condition evaluator. The evaluator is supplied by the caller (typically evaluateConditionLogic partially applied with the draft's eval context) so this helper stays in common/ and doesn't pull the rules engine into the dag layer.

Returned function: given a step key, returns the key of the next step that fires under current data, or null if no transition matches (or the step has no outgoing edges at all). null lets the count helper fall back to a topology BFS estimate from that point.

Parameters

ParameterType
__namedParameters{ evaluateConditionLogicNode: (node: ConditionLogicNode) => boolean; steps: { 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; }[]; transitions: FormStepTransitionWithKey[]; }
__namedParameters.evaluateConditionLogicNode(node: ConditionLogicNode) => boolean
__namedParameters.steps{ 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; }[]
__namedParameters.transitionsFormStepTransitionWithKey[]

Returns

(fromKey: string) => string | null

On this page