Auxx.ai

Workflow Schema

Define typed inputs and outputs for your workflow blocks using the schema builder.

The Workflow schema builder defines the inputs and outputs for workflow blocks and triggers. Values are type-safe and automatically generate the settings panel UI.

import { Workflow } from '@auxx/sdk'

const schema = {
  inputs: {
    apiKey: Workflow.secret({ label: 'API Key' }),
    endpoint: Workflow.url({ label: 'Endpoint', acceptsVariables: true }),
    retries: Workflow.number({ label: 'Retries', default: 3, min: 0, max: 10 }),
    method: Workflow.select({
      label: 'Method',
      options: [
        { value: 'GET', label: 'GET' },
        { value: 'POST', label: 'POST' },
      ],
    }),
  },
  outputs: {
    status: Workflow.number({ label: 'Status Code' }),
    body: Workflow.string({ label: 'Response Body' }),
  },
}

Field types

Primitives

BuilderTypeDescription
Workflow.string(options?)stringText input
Workflow.number(options?)numberNumber input
Workflow.boolean(options?)booleanToggle/checkbox

Specialized strings

BuilderFormatDescription
Workflow.date()dateDate picker
Workflow.datetime()datetimeDate + time picker
Workflow.time()timeTime picker
Workflow.email()emailEmail input
Workflow.url()urlURL input
Workflow.phone()phonePhone number input

Complex types

BuilderTypeDescription
Workflow.select(options)enumDropdown select
Workflow.array(options)arrayList of items
Workflow.struct(fields, options?)objectNested object
Workflow.object(options?)objectFreeform JSON object
Workflow.currency(options?)numberCurrency input
Workflow.secret(options?)stringMasked secret input
Workflow.file(options?)fileFile upload

Common options

All field types accept these base options:

OptionTypeDescription
labelstring?Display label
descriptionstring?Help text
requiredboolean?Whether the field is required
defaultany?Default value
acceptsVariablesboolean?Allow variable interpolation from upstream blocks

String options

Workflow.string({
  label: 'Message',
  placeholder: 'Enter text...',
  minLength: 1,
  maxLength: 500,
  pattern: '^[a-z]+$',
  acceptsVariables: true,
})

Number options

Workflow.number({
  label: 'Amount',
  placeholder: '0',
  min: 0,
  max: 1000,
  integer: true,
  precision: 2,
})

Select options

Workflow.select({
  label: 'Status',
  options: [
    { value: 'active', label: 'Active' },
    { value: 'paused', label: 'Paused' },
  ],
  multi: true,  // allow multiple selections
})

Array options

Workflow.array({
  label: 'Tags',
  items: Workflow.string({ label: 'Tag' }),
  minItems: 1,
  maxItems: 10,
})

Struct options

Workflow.struct(
  {
    name: Workflow.string({ label: 'Name' }),
    email: Workflow.email({ label: 'Email' }),
    role: Workflow.select({
      label: 'Role',
      options: [
        { value: 'admin', label: 'Admin' },
        { value: 'member', label: 'Member' },
      ],
    }),
  },
  { label: 'Contact Info' }
)

Layout sections

Organize the settings panel with sections:

const schema = {
  inputs: {
    to: Workflow.string({ label: 'To' }),
    subject: Workflow.string({ label: 'Subject' }),
    body: Workflow.string({ label: 'Body' }),
    retries: Workflow.number({ label: 'Retries' }),
    timeout: Workflow.number({ label: 'Timeout (ms)' }),
  },
  outputs: { ... },
  layout: [
    {
      type: 'section',
      title: 'Message',
      fields: ['to', 'subject', 'body'],
    },
    {
      type: 'section',
      title: 'Advanced',
      fields: ['retries', 'timeout'],
      collapsible: true,
      initialOpen: false,
    },
  ],
}

Type inference

Input and output types are automatically inferred from the schema:

// If schema.inputs = { to: Workflow.string(), count: Workflow.number() }
// Then execute receives: { to: string, count: number }
// And must return the shape defined by schema.outputs