Kaizen
Browse modulesFormsforms/serverFunctions

Function: toFormStepDto()

function toFormStepDto(row: {
  createdAt: Date;
  createdBy: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  description: string | null;
  fields: JsonValue;
  formSchemaVersionId: string;
  id: string;
  key: string;
  label: string | null;
  updatedAt: Date;
  updatedBy: string | null;
}): {
  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";
  }[];
  formSchemaVersionId: string;
  id: string;
  key: string;
  label: string | null;
};

Defined in: server/forms/steps-dto.ts:18

Project a Prisma FormSteps row onto the canonical FormStep DTO. The single as cast widens the JSON column to its typed shape; Prisma intentionally types JSON columns as JsonValue, so we can't avoid asserting at this trust boundary — but localising it here keeps the rest of the service layer free of as unknown as noise.

Lives in the server lane because the function signature references @prisma/client; the shared FormStep shape it produces is the isomorphic DTO consumers (validators, DAG walkers, build-zod-schema) import from ../../shared/forms.

Parameters

ParameterType
row{ createdAt: Date; createdBy: string | null; deletedAt: Date | null; deletedBy: string | null; description: string | null; fields: JsonValue; formSchemaVersionId: string; id: string; key: string; label: string | null; updatedAt: Date; updatedBy: string | null; }
row.createdAtDate
row.createdBystring | null
row.deletedAtDate | null
row.deletedBystring | null
row.descriptionstring | null
row.fieldsJsonValue
row.formSchemaVersionIdstring
row.idstring
row.keystring
row.labelstring | null
row.updatedAtDate
row.updatedBystring | null

Returns

{
  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";
  }[];
  formSchemaVersionId: string;
  id: string;
  key: string;
  label: string | null;
}

description

description: string | null;

fields

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";
}[];

formSchemaVersionId

formSchemaVersionId: string;

id

id: string;

key

key: string;

label

label: string | null;

On this page