Generated API
One file per BPMN process, a typed projection of the process model, plus one file per kind of shared definition, generated once for all processes of a run. The examples show the MiraVelo bike-leasing process (shared/bpmn/zeebe/bike-leasing.bpmn) generated for Zeebe.
Structure
The Process API is an object (Kotlin), final class (Java), static class (C#) or as const object next to one class per element (TypeScript), named after the process id: bikeLeasing becomes BikeLeasingProcessApi.
| Member | Contents |
|---|---|
PROCESS_ID | The process id (ProcessId) |
PROCESS_ENGINE | The engine the API was generated for (BpmnEngine: ZEEBE, CAMUNDA_7, OPERATON) |
FlowNodes | One node per element, carrying the element's own data and its successors |
Element ids, variables, timers and call-activity mappings have no section of their own: they live on the node that declares them.
Shared definitions
Job types, message and signal names, errors, escalations and variable names identify something across process boundaries: two processes subscribing to the same message use the same value. They are generated once per run, each kind in its own file next to the Process APIs.
| File | Contents |
|---|---|
ServiceTasks | One String constant per distinct job type: the constant for @JobWorker(type = …) |
Messages | Message names (MessageName) |
Signals | Signal names (SignalName) |
Errors | Error definitions with name and code (BpmnErrorDefinition) |
Escalations | Escalation definitions with name and code (BpmnEscalationDefinition) |
ProcessVariables | One String constant per distinct variable name: the constant for @Variable(name = …) |
- A file is only generated when at least one process contains a matching element.
- Each value appears once, however many processes use it.
- Constants are named after the name, not the id: the message
miravelo.contractSignedisMIRAVELO_CONTRACT_SIGNED. This holds for errors and escalations too; the code is a value of the definition, not part of its name. Two different definitions that lead to the same constant fail generation with theshared-definition-collisionrule. - Names that are a FEEL expression (Zeebe, starting with
=) are resolved at runtime and get no constant. A FlowNode that uses one carries the expression as its value. - Every file lists its values: Kotlin
ServiceTasks.all, JavaServiceTasks.all(), C#ServiceTasks.All, TypeScriptServiceTasks.all. That turns "every job type has a registered worker" into a loop in a test.
One packagePath per generation run
The shared files are named after their kind, not after a process. Two runs (Gradle tasks or Maven executions) writing into the same package overwrite each other's ServiceTasks, Messages, … and remove each other's Process APIs as stale. Give each run its own packagePath, or generate all related BPMN files in one run.
Stale files are removed
Before writing, the generator deletes the files it owns but no longer produces, such as the API of a renamed process. It owns the files directly in the packagePath directory that carry the // Generated by bpmn-to-code header. Hand-written files are never touched, so don't keep that header on a file you maintain yourself.
Full Example
Abridged; blank lines and KDoc removed.
// Generated by bpmn-to-code
@file:Suppress("unused")
package com.example.process
import io.miragon.bpmn.runtime.AbstractFlowNode
import io.miragon.bpmn.runtime.BpmnElementType
// … one import per runtime type used
object BikeLeasingProcessApi {
val PROCESS_ID: ProcessId = ProcessId("bikeLeasing")
val PROCESS_ENGINE: BpmnEngine = BpmnEngine.ZEEBE
object FlowNodes {
val all: List<FlowNode> = listOf(BoundaryApplicationInvalid, /* … */ UserTaskUpdateDeliveryAddress)
object ServiceTaskSendContract : AbstractFlowNode(
id = ElementId(ServiceTaskSendContract.ELEMENT_ID),
elementType = BpmnElementType.SERVICE_TASK,
name = "Send contract",
), HasSuccessors<ServiceTaskSendContract.Next>, HasJobType, HasVariables {
const val ELEMENT_ID: String = "serviceTask_sendContract"
override val jobType: String = ServiceTasks.MIRAVELO_SEND_CONTRACT
override val variables: Variables = Variables
override val next: Next = Next
object Variables : RegisteredVariableDefinitions() {
val APPLICATION_ID: VariableName.Input = input(ProcessVariables.APPLICATION_ID)
val CONTRACT_ID: VariableName.Output = output(ProcessVariables.CONTRACT_ID)
}
object Next {
val gatewayAwaitSignature: SequenceFlows<GatewayAwaitSignature>
get() = SequenceFlows.single(
flowId = ElementId("flow_sendContractToAwaitSignature"),
target = GatewayAwaitSignature,
)
}
}
object TimerSignatureReminder : AbstractFlowNode(
id = ElementId(TimerSignatureReminder.ELEMENT_ID),
elementType = BpmnElementType.BOUNDARY_EVENT,
name = "7 days passed",
), HasSuccessors<TimerSignatureReminder.Next>, BoundaryEvent<SubProcessConcludeContract>, TimerEvent {
override val eventType: BpmnEventType = BpmnEventType.TIMER
const val ELEMENT_ID: String = "timer_signatureReminder"
override val timer: BpmnTimer = BpmnTimer(type = TimerType.DURATION, timerValue = "P7D")
override val attachedTo: SubProcessConcludeContract get() = SubProcessConcludeContract
override val isInterrupting: Boolean = false
// next …
}
object EndEventLeasingActive : AbstractFlowNode(
id = ElementId(EndEventLeasingActive.ELEMENT_ID),
elementType = BpmnElementType.END_EVENT,
name = "Leasing active",
), Event {
override val eventType: BpmnEventType = BpmnEventType.NONE
const val ELEMENT_ID: String = "endEvent_leasingActive"
}
// … one object per element, including those inside subprocesses
}
}
// ServiceTasks.kt
object ServiceTasks {
const val MIRAVELO_SEND_CONTRACT: String = "miravelo.sendContract"
// …
val all: List<String> = listOf(/* … */)
}
// Messages.kt
object Messages {
val MIRAVELO_CONTRACT_SIGNED: MessageName = MessageName("miravelo.contractSigned")
// …
}
// Errors.kt
object Errors {
val MIRAVELO_APPLICATION_INVALID: BpmnErrorDefinition = BpmnErrorDefinition(
name = "miravelo.applicationInvalid",
code = "applicationInvalid",
)
}
// ProcessVariables.kt
object ProcessVariables {
const val APPLICATION_ID: String = "applicationId"
const val CONTRACT_ID: String = "contractId"
// …
}// Generated by bpmn-to-code
package com.example.process;
import io.miragon.bpmn.runtime.AbstractFlowNode;
// … one import per runtime type used
import java.util.List;
public final class BikeLeasingProcessApi {
public static final ProcessId PROCESS_ID = new ProcessId("bikeLeasing");
public static final BpmnEngine PROCESS_ENGINE = BpmnEngine.ZEEBE;
public static final class FlowNodes {
public static ServiceTaskSendContract serviceTaskSendContract() { return ServiceTaskSendContract.INSTANCE; }
// … one static accessor per element
public static List<FlowNode> all() { /* … */ }
public static final class ServiceTaskSendContract extends AbstractFlowNode
implements HasSuccessors<ServiceTaskSendContract.Next>, HasJobType, HasVariables {
public static final String ELEMENT_ID = "serviceTask_sendContract";
public static final ServiceTaskSendContract INSTANCE = new ServiceTaskSendContract();
@Override public String getJobType() { return ServiceTasks.MIRAVELO_SEND_CONTRACT; }
@Override public Variables getVariables() { return VARIABLES; }
@Override public Next getNext() { return new Next(); }
public static final class Variables extends VariableDefinitions {
public static final VariableName.Input APPLICATION_ID = new VariableName.Input(ProcessVariables.APPLICATION_ID);
public static final VariableName.Output CONTRACT_ID = new VariableName.Output(ProcessVariables.CONTRACT_ID);
@Override public List<VariableName> getAll() { return List.of(APPLICATION_ID, CONTRACT_ID); }
}
public static final class Next {
public SequenceFlows<GatewayAwaitSignature> gatewayAwaitSignature() {
return SequenceFlows.single(new ElementId("flow_sendContractToAwaitSignature"), GatewayAwaitSignature.INSTANCE);
}
}
}
}
}
// Errors.java
public final class Errors {
public static final BpmnErrorDefinition MIRAVELO_APPLICATION_INVALID = new BpmnErrorDefinition("miravelo.applicationInvalid", "applicationInvalid");
public static List<BpmnErrorDefinition> all() { return List.of(MIRAVELO_APPLICATION_INVALID); }
}// <auto-generated/>
// Generated by bpmn-to-code
#nullable enable
#pragma warning disable CS1591
namespace MiraVelo.Process;
// Runtime.X stands for global::Miragon.BpmnToCode.Runtime.X, as the file writes it
public static class BikeLeasingProcessApi
{
public const string ProcessId = "bikeLeasing";
public const Runtime.BpmnEngine ProcessEngine = Runtime.BpmnEngine.Zeebe;
public static class FlowNodes
{
public static ServiceTaskSendContractNode ServiceTaskSendContract => ServiceTaskSendContractNode.Instance;
public sealed class ServiceTaskSendContractNode : Runtime.IFlowNode, Runtime.IHasSuccessors<ServiceTaskSendContractNode.Successors>, Runtime.IHasJobType, Runtime.IHasVariables
{
// …
public const string ElementId = "serviceTask_sendContract";
public Runtime.ElementId Id { get; } = new(ElementId);
public Runtime.BpmnElementType ElementType => Runtime.BpmnElementType.ServiceTask;
public string? Name => "Send contract";
public string JobType { get; } = ServiceTasks.MiraveloSendContract;
public NodeVariables Variables { get; } = new();
public sealed class NodeVariables : Runtime.VariableDefinitions
{
public Runtime.VariableName.Input ApplicationId { get; } = new(ProcessVariables.ApplicationId);
public Runtime.VariableName.Output ContractId { get; } = new(ProcessVariables.ContractId);
// All …
}
public Successors Next { get; } = new();
public sealed class Successors
{
public Runtime.SequenceFlows<GatewayAwaitSignatureNode> GatewayAwaitSignature => _gatewayAwaitSignature ??= Runtime.SequenceFlows.Single(new("flow_sendContractToAwaitSignature"), FlowNodes.GatewayAwaitSignature);
// …
}
}
}
}
// Errors.cs
public static class Errors
{
public static class MiraveloApplicationInvalid
{
public const string Reference = "miravelo.applicationInvalid";
public const string Code = "applicationInvalid";
}
}FlowNodes: the process as typed nodes
FlowNodes holds one node per element, and every node is a direct child of FlowNodes whatever its subprocess depth: FlowNodes.StartEventCustomerEligible is addressed by its own name although it sits inside subProcess_concludeContract. Node names derive from element ids (serviceTask_sendContract → ServiceTaskSendContract); see Modeling.
Each node extends AbstractFlowNode and implements one runtime interface per facet it has:
| Member, interface | Present on | Type | In the JSON |
|---|---|---|---|
id, elementType, name | every node | ElementId, BpmnElementType, String? | id, type, name |
eventType, Event | events | BpmnEventType (NONE, TIMER, MESSAGE, …, MULTIPLE) | eventDefinitions[] |
jobType, HasJobType | tasks and events with an implementation | String, the ServiceTasks constant | implementation |
variables, HasVariables | nodes declaring variables | the node's Variables | ioMapping, multiInstance |
calledProcess, CallActivity; Inputs, Outputs | call activities | ProcessId; InputOutputMapping | calledElement, ioMapping |
timer, TimerEvent | timer events | BpmnTimer (type: DATE, DURATION, CYCLE; timerValue) | eventDefinitions[] |
message, HasMessage | message events, send and receive tasks | MessageName, the Messages constant | eventDefinitions[], messageRef |
signal / error / escalation; SignalEvent / ErrorEvent / EscalationEvent | events with that definition | the Signals / Errors / Escalations constant | eventDefinitions[] |
CompensationThrowEvent | intermediate throw and end events throwing a compensation | marker without members | eventDefinitions[] |
attachedTo, BoundaryEvent<Host> | boundary events | the host node | attachedToRef |
isInterrupting | boundary events, event-subprocess start events | Boolean | cancelActivity / isInterrupting |
next, HasSuccessors<Next> | nodes with successors | see Navigation | outgoing, boundaryEventRefs, compensationHandlerRef |
startEvents, FlowScope<Start> | subprocesses | the interior's start events | flowNodes[] of the subprocess |
Kotlin reaches a node as FlowNodes.ServiceTaskSendContract, Java through an accessor and getters (FlowNodes.serviceTaskSendContract().getJobType()), C# through a property as well (FlowNodes.ServiceTaskSendContract.JobType, typed FlowNodes.ServiceTaskSendContractNode; the interfaces are Runtime.IHasJobType, Runtime.ITimerEvent, …).
Because every facet is an interface, generic code can pick the nodes that carry it:
val timers: List<TimerEvent> = FlowNodes.all.filterIsInstance<TimerEvent>()
timers.forEach { println("${it.id}: ${it.timer.timerValue}") }Naming rule
Kotlin follows its coding conventions: constants are UPPER_SNAKE (ELEMENT_ID, Variables.APPLICATION_ID), members of the runtime interfaces camelCase (jobType, timer, next). Java exposes the per-node constants ELEMENT_ID and INSTANCE as static final fields and everything else through getters.
Raw names for annotations and when / switch
The typed wrappers are no compile-time constants, so each has a raw String constant:
| Typed | Raw constant (Kotlin / Java) | C# |
|---|---|---|
FlowNodes.X.id | FlowNodes.X.ELEMENT_ID | FlowNodes.X.ElementId |
FlowNodes.X.variables.APPLICATION_ID | ProcessVariables.APPLICATION_ID | ProcessVariables.ApplicationId |
FlowNodes.X.jobType | ServiceTasks.MIRAVELO_SEND_CONTRACT | ServiceTasks.MiraveloSendContract |
@JobWorker(type = ServiceTasks.MIRAVELO_SEND_CONTRACT)
fun sendContract(@Variable(name = ProcessVariables.APPLICATION_ID) applicationId: String) { … }Annotate workers with ServiceTasks.X rather than a node's jobType: several elements, also of different processes, can share one job type, and find-usages on the constant leads to all of them. A node's jobType, message, signal, error and escalation refer to these same constants and answer the opposite question: what does this element use.
Sequence flows
Every entry of a node's Next is named after the element it leads to, so a condition is found by where it goes, not by a flow id. An entry reached by sequence flows is a SequenceFlows<Target>. Its flow is a SequenceFlow<Target> with the flow's id, name, raw conditionExpression, isDefault and typed target.
object GatewayIsSolvent : /* … */ HasSuccessors<GatewayIsSolvent.Next> {
override val next: Next = Next
object Next {
val gatewayCollectRejections: SequenceFlows<GatewayCollectRejections>
get() = SequenceFlows.single(
flowId = ElementId("flow_isSolventToCollectRejections"),
name = "No",
conditionExpression = "=not(solvent)",
target = GatewayCollectRejections,
)
val subProcessConcludeContract: SequenceFlows<SubProcessConcludeContract>
get() = SequenceFlows.single(
flowId = ElementId("flow_isSolventToConcludeContract"),
name = "Yes",
isDefault = true,
target = SubProcessConcludeContract,
)
}
}val next = FlowNodes.GatewayIsSolvent.next
assertThat(next.gatewayCollectRejections.flow.conditionExpression).isEqualTo("=not(solvent)")
assertThat(next.gatewayCollectRejections.target).isEqualTo(FlowNodes.GatewayCollectRejections)
assertThat(next.subProcessConcludeContract.flow.isDefault).isTrue()var next = FlowNodes.gatewayIsSolvent().getNext();
assertThat(next.gatewayCollectRejections().getFlow().getConditionExpression()).isEqualTo("=not(solvent)");
assertThat(next.subProcessConcludeContract().getFlow().isDefault()).isTrue();The expression is the one in the model: FEEL (=…) on Zeebe, ${…} on Camunda 7 and Operaton.
When several sequence flows lead to the same element, the entry keeps its name and holds all of them in flows. flow then fails and asks you to pick one.
Navigation
next returns the node's Next. Its entries are everything reachable from the node, each a Successor<Target>:
| Successor | Leads to |
|---|---|
SequenceFlows<Target> | an element reached by one or more sequence flows |
AttachedBoundaryEvent<Target> | a boundary event attached to this node |
AssociatedCompensationHandler<Target> | the handler of a compensation boundary event, which BPMN connects by an association |
object SubProcessConcludeContract : /* … */
HasSuccessors<SubProcessConcludeContract.Next>, FlowScope<SubProcessConcludeContract.Start> {
override val next: Next = Next
override val startEvents: Start = Start
object Next {
val gatewayFork: SequenceFlows<GatewayFork>
get() = SequenceFlows.single(flowId = ElementId("flow_concludeContractToFork"), target = GatewayFork)
val timerSignatureReminder: AttachedBoundaryEvent<TimerSignatureReminder>
get() = AttachedBoundaryEvent(target = TimerSignatureReminder)
val boundaryCompensateContract: AttachedBoundaryEvent<BoundaryCompensateContract>
get() = AttachedBoundaryEvent(target = BoundaryCompensateContract)
// …
}
object Start {
val startEventCustomerEligible: StartEventCustomerEligible get() = StartEventCustomerEligible
}
}The target type is fixed per entry, so code that follows an edge the model no longer has stops compiling. A subprocess additionally implements FlowScope and opens its interior through startEvents. On a compensation boundary event, isInterrupting carries no meaning: BPMN does not define cancelActivity for it.
Successor is a sealed interface; an exhaustive when over it needs a branch for each of the three kinds and for a single SequenceFlow.
Asserting flow in process tests: ProcessPath
The runtime's path builder walks this graph and returns the element ids for your engine's flow assertions. It has a page of its own: ProcessPath.
Enumerating elements
For tests about every element of a process (every node id exists in the deployed model, every user task has a form), FlowNodes lists its nodes: Kotlin FlowNodes.all, Java FlowNodes.all(), C# FlowNodes.All.
@Test
fun `every node of the model is deployed`() {
val deployedIds = deployedModel.flowNodeIds()
assertThat(FlowNodes.all.map { it.id.value }).allMatch { it in deployedIds }
}Variables with Direction
Every variable sits on the node that declares it, and its direction is its type: VariableName.Input when the element reads it, VariableName.Output when it writes it, VariableName.InOut when it does both. An API taking VariableName.Output therefore rejects an input at compile time. Which model elements declare a variable, and in which direction, depends on the engine.
object Variables : RegisteredVariableDefinitions() {
val APPLICATION_ID: VariableName.Input = input(ProcessVariables.APPLICATION_ID)
val CONTRACT_ID: VariableName.Output = output(ProcessVariables.CONTRACT_ID)
}Variables is only generated on nodes that declare at least one variable. Such a node implements HasVariables and lists all its variables, those it reads (inputs) and those it writes (outputs); an InOut is in both.
| Kotlin | Java | C# | |
|---|---|---|---|
| One variable | ServiceTaskSendContract.variables.APPLICATION_ID | ServiceTaskSendContract.Variables.APPLICATION_ID | ServiceTaskSendContract.Variables.ApplicationId |
| All / read / written | variables.all / .inputs / .outputs | getVariables().getAll() / .getInputs() / .getOutputs() | Variables.All / .Inputs / .Outputs |
val workers = FlowNodes.all.filterIsInstance<HasJobType>()
workers.forEach { task ->
val readVariables = (task as? HasVariables)?.variables?.inputs.orEmpty()
client.newWorker().jobType(task.jobType).fetchVariables(readVariables.map { it.value }) // …
}
val variablesOfTheProcess: List<String> = HasVariables.distinctVariablesOf(FlowNodes.all)Call-Activity Variable Mappings
A call activity node carries the called process and the mapping between parent and child: Inputs (passed into the child) and Outputs (returned to the parent). Each entry is an InputOutputMapping with the target (the name the variable gets in the receiving scope) and its origin. Constants are named after the target.
object CallActivityCancelBikeOrder : /* … */ CallActivity, HasVariables {
override val calledProcess: ProcessId = ProcessId("cancelBikeOrder")
object Inputs {
val APPLICATION_ID: InputOutputMapping = InputOutputMapping(target = "applicationId", source = "=applicationId")
val ORDER_IDS: InputOutputMapping = InputOutputMapping(target = "orderIds", source = "=orderIds")
}
object Outputs {
val CANCELLATION_COSTS: InputOutputMapping = InputOutputMapping(target = "cancellationCosts", source = "=cancellationCosts")
}
}| Engine | source | sourceExpression |
|---|---|---|
| Zeebe | the FEEL expression of zeebe:input / zeebe:output | always null |
| Camunda 7, Operaton | the source variable of camunda:in / camunda:out | its sourceExpression, e.g. ${applicationId} |
The same model for Camunda 7 yields InputOutputMapping(target = "applicationId", sourceExpression = "\${applicationId}"). The "pass all variables" modes (variables="all", propagateAllParentVariables / propagateAllChildVariables) produce no constants.
Several files, one process id
Two files declaring the same process id would be generated under one name, so generation fails. A variantName extension property on the process tells them apart: corporate turns BikeLeasingProcessApi into CorporateBikeLeasingProcessApi, while PROCESS_ID stays bikeLeasing. Nothing is merged between the files. See Modeling for the XML and the rules.
C# specifics
- The runtime types come from
Miragon.BpmnToCode.Runtime, the NuGet package of the generator's version;Miragon.BpmnToCode.MSBuildadds it. The generated code names them asglobal::Miragon.BpmnToCode.Runtime.IFlowNodeand so on, so no type or namespace of your own can shadow them. A library can type againstIFlowNodeor take aProcessPathwhatever Process API it is used with.ElementId,ProcessId,MessageName,SignalNameandVariableNameconvert implicitly tostring. The process path lives in the package too. - Shared definitions are plain
const strings. Errors and escalations are a nested class withReferenceandCode; theirAlllists(Reference, Code)tuples. - Nodes are properties of
FlowNodes:FlowNodes.ServiceTaskSendContract, navigated throughNext.X.Target,Next.X.Flow.ConditionExpressionandStart.X. Their type carries aNodesuffix (FlowNodes.ServiceTaskSendContractNode), so no member has to make way for the type's name. ElementstaskandtaskNodecannot both be generated: the type oftaskwould be named like the property oftaskNode, so generation fails.NextandStartare created with the node, every successor on first read. - The namespace is the package path in PascalCase:
io.miravelo.processbecomesIo.Miravelo.Process; the files still go toio/miravelo/process. - Constants versus properties.
ServiceTasks.X,ProcessVariables.Xand a node'sElementId(FlowNodes.ServiceTaskSendContractNode.ElementId) areconst stringand usable in attributes andswitchlabels.Id,Name,JobTypeand the other facets are instance properties and are not. - Some names fail generation instead of being renamed. A variable named
all,inputs,outputs,processVariablesornodeVariables, a call-activity mapping intoinputMappingsoroutputMappings, and a message, signal, job type or variable named like its shared class (Messages, …) would clash with a member C# declares itself. Generation names the element or definition to rename. - No
distinctVariablesOf. Collect the variables of the process with LINQ:FlowNodes.All.OfType<IHasVariables>().SelectMany(node => node.Variables.All).Distinct(). - Each file is marked
<auto-generated/>, enables nullable annotations itself and suppresses CS1591, so it compiles under any consumer settings.
A .NET project generates C# during dotnet build with the MSBuild package; the web app, the command line and the Gradle and Maven plugins accept CSHARP as well.
TypeScript specifics
Experimental
TypeScript output is experimental. It may change in a minor release. Feedback welcome.
Node projects get it through the npm package. TypeScript gets the same API as Kotlin: constants, one class per element, navigation through next and a process path. That covers a worker that needs its job types and variable names, a frontend that shows the name of a step and what follows it, and a process test that asserts the route an instance took.
import { BikeLeasingProcessApi } from "./process/BikeLeasingProcessApi.js";
import { ServiceTasks } from "./process/ServiceTasks.js";
const nodes = BikeLeasingProcessApi.FlowNodes;
const sendContract = nodes.ServiceTaskSendContract;
sendContract.id; // "serviceTask_sendContract"
sendContract.name; // "Send contract"
sendContract.jobType === ServiceTasks.MIRAVELO_SEND_CONTRACT; // true
const solvent = nodes.StartEventLeasingRequestReceived
.next.serviceTaskValidateApplication.target
.next.businessRuleTaskCheckCreditRating.target
.next.gatewayIsSolvent.target;
const approved = solvent.next.subProcessConcludeContract;
approved.target.name; // "Conclude contract"
approved.flow.isDefault; // true
solvent.next.gatewayFork; // compile error: the gateway does not lead there- One exported singleton class per element, reached as
FlowNodes.ServiceTaskSendContractand listed inFlowNodes.all. A class implements the interfaces of the runtime package that fit it (HasJobType,BoundaryEvent<Host>, …), so code that handles nodes generically takes aFlowNode. The class name works as a type:function show(node: ServiceTaskSendContract). The classes are top-level exports of their module, so re-exporting two Process APIs withexport *from one barrel file clashes on elements both processes have; import from each module instead. - Literal types. Every value has its literal type (
"serviceTask_sendContract","P14D",true), and the shared definitions areas constobjects: a worker can be typed as(typeof ServiceTasks)[Exclude<keyof typeof ServiceTasks, "all">]. - A node carries
ELEMENT_IDandid,elementType,eventTypefor events,name(nullwhen the model has none) and its own data:jobType,calledProcess,timer,message,signal,error,escalation,isInterrupting,throwsCompensation,variables,Inputs,Outputs. - Navigation is the one of Kotlin.
nextholds the successors under the name of their element:next.x.targetis the element,next.x.flowthe sequence flow when exactly one leads there,next.x.flowsall of them. A boundary event isRuntime.AttachedBoundaryEvent, the handler of a compensation boundary eventRuntime.AssociatedCompensationHandler;kindtells them apart. A subprocess opens its interior throughstartEvents, a boundary event names its host asattachedTo. These are getters, so the module loads in any order of its classes. variablesholds aRuntime.VariableName<"INPUT" | "OUTPUT" | "IN_OUT">per variable plusall,inputsandoutputs. AVariableNameconverts to its name in a template string.- The runtime types come from
@miragon/bpmn-to-code-runtime, the npm package of the generator's version, which the generated files import asRuntime. A library can type againstFlowNodeor take aProcessPathwhatever Process API it is used with. The process path lives in the package too; Setup shows how the versions are kept together. - Imports end in
.js, whichmoduleResolutionnodenextrequires andbundleraccepts. packagePathnames the directory belowoutputFolderPath, with dots as separators, as for the other languages.