Kaizen
Browse modulesFormsforms/serverClasses

Class: FormSchemaVersion

Defined in: server/forms/models.ts:88

Constructors

Constructor

new FormSchemaVersion(record: {
  changeReason: string | null;
  createdAt: Date;
  createdBy: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  entryStepKey: string | null;
  formSchemaId: string;
  id: string;
  publishedAt: Date | null;
  schema: JsonValue;
  versionNumber: number;
}): FormSchemaVersion;

Defined in: server/forms/models.ts:91

Parameters

ParameterTypeDescription
record{ changeReason: string | null; createdAt: Date; createdBy: string | null; deletedAt: Date | null; deletedBy: string | null; entryStepKey: string | null; formSchemaId: string; id: string; publishedAt: Date | null; schema: JsonValue; versionNumber: number; }-
record.changeReasonstring | null-
record.createdAtDate-
record.createdBystring | null-
record.deletedAtDate | null-
record.deletedBystring | null-
record.entryStepKeystring | null-
record.formSchemaIdstring-
record.idstring-
record.publishedAtDate | null-
record.schemaJsonValueLegacy single-page schema content. Null for multi-step versions — those render from the form_steps table instead.
record.versionNumbernumber-

Returns

FormSchemaVersion

Properties

record

readonly record: {
  changeReason: string | null;
  createdAt: Date;
  createdBy: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  entryStepKey: string | null;
  formSchemaId: string;
  id: string;
  publishedAt: Date | null;
  schema: JsonValue;
  versionNumber: number;
};

Defined in: server/forms/models.ts:89

changeReason

changeReason: string | null;

createdAt

createdAt: Date;

createdBy

createdBy: string | null;

deletedAt

deletedAt: Date | null;

deletedBy

deletedBy: string | null;

entryStepKey

entryStepKey: string | null;

formSchemaId

formSchemaId: string;

id

id: string;

publishedAt

publishedAt: Date | null;

schema

schema: JsonValue;

Legacy single-page schema content. Null for multi-step versions — those render from the form_steps table instead.

versionNumber

versionNumber: number;

Accessors

changeReason

Get Signature

get changeReason(): string | null;

Defined in: server/forms/models.ts:158

Returns

string | null


createdAt

Get Signature

get createdAt(): Date;

Defined in: server/forms/models.ts:162

Returns

Date


createdBy

Get Signature

get createdBy(): string | null;

Defined in: server/forms/models.ts:166

Returns

string | null


entryStepKey

Get Signature

get entryStepKey(): string | null;

Defined in: server/forms/models.ts:145

Multi-step entry key. Null for legacy single-page versions; the draft service uses this to seed currentStepKey on a new draft.

Returns

string | null


formSchemaId

Get Signature

get formSchemaId(): string;

Defined in: server/forms/models.ts:99

Returns

string


hasLegacySchema

Get Signature

get hasLegacySchema(): boolean;

Defined in: server/forms/models.ts:137

true if this version has a non-null legacy schema blob — i.e. it's a single-page form, not a multi-step one. The inverse of entryStepKey !== null. Use this guard before reading .schema.

Returns

boolean


id

Get Signature

get id(): string;

Defined in: server/forms/models.ts:95

Returns

string


isPublished

Get Signature

get isPublished(): boolean;

Defined in: server/forms/models.ts:154

true once publishVersion has flipped this version's publishedAt. Draft versions are mutable; published versions are frozen — see BaseFormService.assertVersionUnpublished.

Returns

boolean


schema

Get Signature

get schema(): {
  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";
  }[];
};

Defined in: server/forms/models.ts:120

The legacy single-page schema content. Multi-step versions render off the FormSteps table and persist null here; accessing this getter on a multi-step version throws. Guard with hasLegacySchema or use getFieldsForVersion from server/version-fields.ts when you need fields uniformly across both authoring modes.

Throwing (instead of silently returning { fields: [] }) catches the trap where downstream code reads .fields against a multi-step version and gets an empty list — historically the root cause of silent prefill drops and skipped historical-type-conflict checks.

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

versionNumber

Get Signature

get versionNumber(): number;

Defined in: server/forms/models.ts:103

Returns

number

Methods

toJSON()

toJSON(): {
  changeReason: string | null;
  createdAt: Date;
  createdBy: string | null;
  entryStepKey: string | null;
  formSchemaId: string;
  id: string;
  isPublished: boolean;
  schema:   | {
     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";
     }[];
   }
     | null;
  versionNumber: number;
};

Defined in: server/forms/models.ts:174

Returns

{
  changeReason: string | null;
  createdAt: Date;
  createdBy: string | null;
  entryStepKey: string | null;
  formSchemaId: string;
  id: string;
  isPublished: boolean;
  schema:   | {
     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";
     }[];
   }
     | null;
  versionNumber: number;
}
changeReason
changeReason: string | null;
createdAt
createdAt: Date;
createdBy
createdBy: string | null;
entryStepKey
entryStepKey: string | null;
formSchemaId
formSchemaId: string;
id
id: string;
isPublished
isPublished: boolean;
schema
schema: 
  | {
  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";
  }[];
}
  | null;
versionNumber
versionNumber: number;

toRaw()

toRaw(): {
  changeReason: string | null;
  createdAt: Date;
  createdBy: string | null;
  deletedAt: Date | null;
  deletedBy: string | null;
  entryStepKey: string | null;
  formSchemaId: string;
  id: string;
  publishedAt: Date | null;
  schema: JsonValue;
  versionNumber: number;
};

Defined in: server/forms/models.ts:170

Returns

changeReason
changeReason: string | null;
createdAt
createdAt: Date;
createdBy
createdBy: string | null;
deletedAt
deletedAt: Date | null;
deletedBy
deletedBy: string | null;
entryStepKey
entryStepKey: string | null;
formSchemaId
formSchemaId: string;
id
id: string;
publishedAt
publishedAt: Date | null;
schema
schema: JsonValue;

Legacy single-page schema content. Null for multi-step versions — those render from the form_steps table instead.

versionNumber
versionNumber: number;

On this page