Configurable event state machines
Give calendar events named states and explicit transitions instead of relying on loosely related flags. Guards and optional approval flows determine whether a proposed transition is accepted.
Loading interactive demo…
What you configure
- stateMachines
- Define machine IDs, initial states, allowed states, and named transitions.
- defaultStateMachineId
- Choose the default machine for workflow events.
- extendedProps.workflow.machineId
- Select a different machine for an individual event when needed.
Essential integration
This assumes the shared Quick start already provides premiumLicense and, for UI views, premiumCalendarOptions. Only the feature-specific setup is shown.
import { EnterpriseCalendarWorkflow } from '@wts-calendar/core/enterprise-workflow';
const workflow = new EnterpriseCalendarWorkflow({
license: premiumLicense,
actor: { id: 'editor-1', roles: ['editor'] },
online: false,
autoFlush: false,
events: [
{
id: 'release',
title: 'Release window',
start: '2026-09-07T09:00:00Z',
end: '2026-09-07T10:00:00Z',
},
],
defaultPermission: 'deny',
permissionPolicies: [
{
id: 'editor-transitions',
effect: 'allow',
actions: ['transition', 'flush'],
roles: ['editor'],
},
],
defaultStateMachineId: 'release-flow',
stateMachines: [
{
id: 'release-flow',
initialState: 'draft',
states: ['draft', 'review', 'approved'],
transitions: [
{ name: 'submit', from: 'draft', to: 'review' },
{ name: 'approve', from: 'review', to: 'approved' },
],
},
],
});
export async function transition(name: 'submit' | 'approve') {
await workflow.submit({ type: 'transition', eventId: 'release', transition: name });
workflow.setOnline(true);
await workflow.flush();
return workflow.getEvent('release')?.state;
}Behavior and lifecycle
- Transition guards run before a mutation is accepted.
- Workflow records expose current state and version; optimistic events also mirror workflow metadata.
Limits and responsibilities
- The engine does not implicitly mutate an existing calendar instance; subscribe and apply snapshots yourself.
- Server-side transition validation is required when your backend is authoritative.
Premium
Enable this capability
- Optional module
- @wts-calendar/core/enterprise-workflow
- Local capability ID
- enterprise-workflow · enabled by package-wide Premium
Use the request form to describe your project and deployment origins. Pricing and terms are confirmed privately. A WTS license is separate from provider credentials; do not send passwords or production access tokens.
The live example uses a browser-visible deployment key restricted to this package and approved origins. It does not collect license keys or visitor credentials.