Skip to content

field

field contains builders for declaring plugin inputs and outputs.

The schema is used in three places:

  • TypeScript inference for input and returned output objects;
  • generated manifest.json during liatir build;
  • Liatir UI forms and pipeline ports after import.

Import

ts
import { field, output } from "@liatir/api";

field.* is the normal builder set. output.file(...) is useful for file outputs because it types returned file values correctly.

Input field types

Inputs support:

BuilderTypeScript valueNotes
field.string(...)stringText input.
field.number(...)numberNumeric input.
field.boolean(...)booleanToggle input.
field.file(...)stringLocal file path selected in Liatir.
ts
inputs: {
  fastq: field.file({
    label: "FASTQ file",
    description: "Input reads.",
    required: true,
    accept: ["fastq", "fq", "fastq.gz", "fq.gz"],
  }),
}

Output field types

Outputs support:

BuilderTypeScript valueNotes
field.string(...)stringText output.
field.number(...)numberNumeric output.
field.boolean(...)booleanBoolean output.
output.file(...)file valueExisting path or content to save.
field.json(...)JSON valueStructured JSON output.
field.stats(...)ToolOutputStructured Liatir result output.
ts
outputs: {
  length: field.number({
    label: "Length",
    description: "Number of characters.",
    format: "integer",
  }),
}

Shared options

OptionDescription
labelHuman-readable field label.
descriptionShort explanation shown in the UI.
requiredWhether the input must be filled before running.
defaultDefault value.
acceptAccepted extensions for file inputs.
extExpected extensions for file outputs.
formatNumeric output display hint: integer, decimal, percent, or bytes.

File output values

A file output can return an existing path:

ts
return {
  report: "/absolute/path/to/report.csv",
};

Or content that Liatir should persist under workspace Results:

ts
return {
  report: {
    content: "sample,score\nA,0.92\n",
    fileName: "report.csv",
  },
};

For binary content, return base64:

ts
return {
  image: {
    content: pngBase64,
    fileName: "plot.png",
    base64: true,
  },
};

Liatir — powerful bioinformatics on your machine.

By using this app, you agree to our Privacy Policy and Terms of Service.