src/platform/packages/shared/kbn-workflows/README.md
Common types, utilities, and constants for the Workflows platform feature.
This package contains shared code used by both the workflows execution engine and workflows management plugins. It provides the foundational types, schemas, and utilities needed for workflow operations across the platform.
The @kbn/workflows package serves as the common foundation for all workflow-related functionality in Kibana. It includes:
This package exports feature flag constants that control workflow functionality:
import {
WORKFLOWS_UI_SETTING_ID
} from '@kbn/workflows';
WORKFLOWS_UI_SETTING_ID (workflows:ui:enabled): Controls the workflows management UIThe package exports essential workflow types:
import type {
WorkflowDefinition,
WorkflowExecution,
WorkflowSpec,
WorkflowStepType,
WorkflowStepDefinition
} from '@kbn/workflows';
Represents the structure and configuration of a workflow:
interface WorkflowDefinition {
id: string;
name: string;
description?: string;
steps: WorkflowStepDefinition[];
triggers?: WorkflowTrigger[];
variables?: Record<string, any>;
}
Represents a runtime instance of a workflow:
interface WorkflowExecution {
id: string;
workflowId: string;
status: ExecutionStatus;
createdAt: string;
completedAt?: string;
context: Record<string, any>;
steps: StepExecution[];
}
The package includes comprehensive schema definitions for workflow structure:
Workflow plugins use this package for shared functionality:
// In workflows execution engine
import { WorkflowDefinition } from '@kbn/workflows';
// In workflows management
import { WORKFLOWS_UI_SETTING_ID } from '@kbn/workflows/common/constants';
The package ensures type safety across all workflow operations:
import type { WorkflowDefinition } from '@kbn/workflows';
function processWorkflow(workflow: WorkflowDefinition) {
// TypeScript ensures proper workflow structure
const { id, name, steps } = workflow;
// ...
}
The package is organized into several key areas:
types/: Core TypeScript type definitionsspec/: Workflow specification and schemacommon/: Shared constants and utilitiesThe package provides validation utilities for workflow definitions:
import { validateWorkflowDefinition } from '@kbn/workflows';
const isValid = validateWorkflowDefinition(workflowDef);
Generate YAML schemas for workflow files:
import { generateYamlSchema } from '@kbn/workflows';
const schema = generateYamlSchema();
This enables IDE support and validation for workflow YAML files.
When extending workflow functionality:
This package has minimal dependencies to ensure it can be used across different contexts: