Kaizen
Browse modulesFormsforms/sharedFunctions

Function: parseImportData()

function parseImportData(text: string): ParseResult<FormSchemaExportData>;

Defined in: shared/forms/form-schema-io.ts:64

Parse a serialized form-schema import payload. Accepts three shapes in preference order:

  1. New envelope: { name, schema, exportedAt } — the canonical output of buildExportData.
  2. Legacy envelope: { name?, schema } — older exports without an exportedAt field. Synthesises exportedAt: "".
  3. Bare content: { fields: [...] } — the schema object alone, with no envelope at all. Synthesises name: "" and exportedAt: "".

Anything else returns a parse error.

Parameters

ParameterType
textstring

Returns

ParseResult<FormSchemaExportData>

On this page