Linea Docs

Workflows

Defining, deploying, and managing workflows within a space.

Workflows

A Workflow is the core unit of automation in Linea. It belongs to a Space and defines a sequence of steps that are executed together.

Schema

workflows: {
  id: uuid PK
  spaceId: uuid FKspaces (cascade delete)
  name: text
  description: text | null
  definition: jsonb             // step graph (runtime-defined)
  deployedAt: timestamp | null  // null = draft
  starred: boolean              // user favourite
  deletedAt: timestamp | null   // soft delete (trash)
  createdAt: timestamp
  updatedAt: timestamp
}

Lifecycle States

StateCondition
DraftdeployedAt IS NULL and deletedAt IS NULL
DeployeddeployedAt IS NOT NULL and deletedAt IS NULL
TrasheddeletedAt IS NOT NULL

Workflows can be trashed and restored. Trashed workflows are excluded from all list queries by default.

API Endpoints

MethodPathDescription
GET/workspaces/:wId/spaces/:sId/workflowsList (supports ?trashed=true, ?starred=true)
POST/workspaces/:wId/spaces/:sId/workflowsCreate workflow
GET/workspaces/:wId/spaces/:sId/workflows/:idGet workflow
PATCH/workspaces/:wId/spaces/:sId/workflows/:idUpdate name/description/definition
PATCH/workspaces/:wId/spaces/:sId/workflows/:id/starToggle starred
PATCH/workspaces/:wId/spaces/:sId/workflows/:id/trashSoft delete
PATCH/workspaces/:wId/spaces/:sId/workflows/:id/restoreRestore from trash

Service: Key Methods

findAll(spaceId, query)

const conditions = [eq(workflows.spaceId, spaceId)]
if (query.trashed) {
  conditions.push(isNotNull(workflows.deletedAt))
} else {
  conditions.push(isNull(workflows.deletedAt))
  if (query.starred) conditions.push(eq(workflows.starred, true))
}

trash(spaceId, id, membership)

Requires editor role or above. Sets deletedAt = now().

restore(spaceId, id, membership)

Requires editor role. Sets deletedAt = null.

Frontend

The workflows page lives at /spaces/[spaceId]/workflows and supports three view tabs:

  • All: active (non-trashed) workflows
  • Starred: active + starred = true
  • Trash: trashed workflows with a Restore action

The "New workflow" button is currently disabled pending the visual workflow builder. The definition JSONB field is reserved for the step graph once the builder ships.

On this page