/** * ELK-BPMN Input Types * Based on elk-bpmn-schema.json v2.0 */ interface ElkBpmnGraph { id: string; layoutOptions?: ElkLayoutOptions; bpmn?: DefinitionsMetadata; children: (Collaboration | Process)[]; messages?: MessageDefinition[]; signals?: SignalDefinition[]; errors?: ErrorDefinition[]; escalations?: EscalationDefinition[]; } interface DefinitionsMetadata { targetNamespace?: string; exporter?: string; exporterVersion?: string; } interface ElkLayoutOptions { 'elk.algorithm'?: 'layered' | 'stress' | 'mrtree' | 'radial' | 'force' | 'disco' | 'box' | 'fixed' | 'random'; 'elk.direction'?: 'RIGHT' | 'DOWN' | 'LEFT' | 'UP'; 'elk.spacing.nodeNode'?: number; 'elk.spacing.edgeNode'?: number; 'elk.spacing.edgeEdge'?: number; 'elk.layered.spacing.nodeNodeBetweenLayers'?: number; 'elk.layered.spacing.edgeNodeBetweenLayers'?: number; 'elk.layered.spacing.edgeEdgeBetweenLayers'?: number; 'elk.partitioning.activate'?: boolean; 'elk.partitioning.partition'?: number; 'elk.hierarchyHandling'?: 'INCLUDE_CHILDREN' | 'SEPARATE_CHILDREN'; 'elk.layered.crossingMinimization.strategy'?: 'LAYER_SWEEP' | 'INTERACTIVE'; 'elk.layered.nodePlacement.strategy'?: 'SIMPLE' | 'BRANDES_KOEPF' | 'LINEAR_SEGMENTS' | 'NETWORK_SIMPLEX'; 'elk.edgeRouting'?: 'POLYLINE' | 'ORTHOGONAL' | 'SPLINES'; [key: string]: string | number | boolean | undefined; } interface MessageDefinition { id: string; name?: string; } interface SignalDefinition { id: string; name?: string; } interface ErrorDefinition { id: string; name?: string; errorCode?: string; } interface EscalationDefinition { id: string; name?: string; escalationCode?: string; } interface Collaboration { id: string; bpmn: CollaborationBpmn; layoutOptions?: ElkLayoutOptions; children: Participant[]; edges?: MessageFlow[]; } interface CollaborationBpmn { type: 'collaboration'; name?: string; isClosed?: boolean; } interface Participant { id: string; width?: number; height?: number; bpmn: ParticipantBpmn; layoutOptions?: ElkLayoutOptions; children?: (Lane | FlowNode)[]; edges?: SequenceFlow[]; } interface ParticipantBpmn { type: 'participant'; name?: string; processRef?: string; isBlackBox?: boolean; participantMultiplicity?: { minimum?: number; maximum?: number; }; } interface Lane { id: string; width?: number; height?: number; bpmn: LaneBpmn; layoutOptions?: ElkLayoutOptions & { 'elk.partitioning.partition'?: number; }; children?: (Lane | FlowNode)[]; } interface LaneBpmn { type: 'lane'; name?: string; } interface Process { id: string; bpmn: ProcessBpmn; layoutOptions?: ElkLayoutOptions; children?: (Lane | FlowNode)[]; edges?: (SequenceFlow | DataAssociation)[]; artifacts?: Artifact[]; } interface ProcessBpmn { type: 'process'; name?: string; isExecutable?: boolean; processType?: 'None' | 'Public' | 'Private'; isClosed?: boolean; } interface FlowNode { id: string; width?: number; height?: number; bpmn: BpmnEvent | BpmnTask | BpmnGateway | BpmnSubProcess | BpmnCallActivity; labels?: Label[]; ports?: Port[]; children?: FlowNode[]; edges?: SequenceFlow[]; boundaryEvents?: BoundaryEvent[]; } interface Label { text?: string; width?: number; height?: number; x?: number; y?: number; } interface Port { id: string; width?: number; height?: number; x?: number; y?: number; } type EventType = 'startEvent' | 'endEvent' | 'intermediateCatchEvent' | 'intermediateThrowEvent' | 'boundaryEvent'; type EventDefinitionType = 'none' | 'message' | 'timer' | 'error' | 'escalation' | 'cancel' | 'compensation' | 'conditional' | 'link' | 'signal' | 'terminate' | 'multiple' | 'parallelMultiple'; interface BpmnEvent { type: EventType; eventDefinitionType: EventDefinitionType; name?: string; isInterrupting?: boolean; parallelMultiple?: boolean; messageRef?: string; signalRef?: string; errorRef?: string; escalationRef?: string; timerEventDefinition?: TimerEventDefinition; conditionalEventDefinition?: ConditionalEventDefinition; linkEventDefinition?: LinkEventDefinition; } interface BoundaryEvent { id: string; width?: number; height?: number; attachedToRef: string; bpmn: BoundaryEventBpmn; labels?: Label[]; } interface BoundaryEventBpmn { type: 'boundaryEvent'; eventDefinitionType: Exclude; name?: string; isInterrupting?: boolean; cancelActivity?: boolean; messageRef?: string; signalRef?: string; errorRef?: string; escalationRef?: string; timerEventDefinition?: TimerEventDefinition; conditionalEventDefinition?: ConditionalEventDefinition; } interface TimerEventDefinition { timeDate?: string; timeDuration?: string; timeCycle?: string; } interface ConditionalEventDefinition { condition?: FormalExpression; } interface LinkEventDefinition { name?: string; source?: string[]; target?: string; } type TaskType = 'task' | 'userTask' | 'serviceTask' | 'scriptTask' | 'businessRuleTask' | 'sendTask' | 'receiveTask' | 'manualTask'; interface BpmnTask { type: TaskType; name?: string; documentation?: string; assignee?: string; candidateUsers?: string[]; candidateGroups?: string[]; dueDate?: string; priority?: string; formKey?: string; implementation?: string; operationRef?: string; script?: ScriptDefinition; messageRef?: string; instantiate?: boolean; loopCharacteristics?: LoopCharacteristics; ioSpecification?: IoSpecification; } interface ScriptDefinition { scriptFormat?: string; script?: string; resultVariable?: string; } type GatewayType = 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'eventBasedGateway' | 'complexGateway'; type GatewayDirection = 'Unspecified' | 'Converging' | 'Diverging' | 'Mixed'; interface BpmnGateway { type: GatewayType; name?: string; gatewayDirection?: GatewayDirection; default?: string; instantiate?: boolean; eventGatewayType?: 'Exclusive' | 'Parallel'; activationCondition?: string; } type SubProcessType = 'subProcess' | 'transaction' | 'adHocSubProcess' | 'eventSubProcess'; interface BpmnSubProcess { type: SubProcessType; name?: string; triggeredByEvent?: boolean; isExpanded?: boolean; loopCharacteristics?: LoopCharacteristics; adHocOrdering?: 'Parallel' | 'Sequential'; adHocCompletionCondition?: string; cancelRemainingInstances?: boolean; transactionProtocol?: string; } interface BpmnCallActivity { type: 'callActivity'; name?: string; calledElement?: string; calledElementBinding?: 'latest' | 'deployment' | 'version'; calledElementVersion?: string; inheritBusinessKey?: boolean; loopCharacteristics?: LoopCharacteristics; inMappings?: ParameterMapping[]; outMappings?: ParameterMapping[]; } interface ParameterMapping { source?: string; sourceExpression?: string; target?: string; } interface LoopCharacteristics { loopType?: 'standard' | 'multiInstance'; isSequential?: boolean; loopCardinality?: string; loopDataInputRef?: string; loopDataOutputRef?: string; inputDataItem?: string; outputDataItem?: string; completionCondition?: string; loopCondition?: string; loopMaximum?: number; testBefore?: boolean; } interface IoSpecification { dataInputs?: DataInput[]; dataOutputs?: DataOutput[]; inputSets?: InputSet[]; outputSets?: OutputSet[]; } interface DataInput { id?: string; name?: string; itemSubjectRef?: string; isCollection?: boolean; } interface DataOutput { id?: string; name?: string; itemSubjectRef?: string; isCollection?: boolean; } interface InputSet { id?: string; name?: string; dataInputRefs?: string[]; } interface OutputSet { id?: string; name?: string; dataOutputRefs?: string[]; } interface Artifact { id: string; width?: number; height?: number; bpmn: DataObjectArtifact | DataStoreArtifact | TextAnnotationArtifact | GroupArtifact; labels?: Label[]; } interface DataObjectArtifact { type: 'dataObject' | 'dataObjectReference'; name?: string; dataObjectRef?: string; itemSubjectRef?: string; isCollection?: boolean; dataState?: { name?: string; }; } interface DataStoreArtifact { type: 'dataStoreReference'; name?: string; dataStoreRef?: string; capacity?: number; isUnlimited?: boolean; } interface TextAnnotationArtifact { type: 'textAnnotation'; text?: string; textFormat?: string; } interface GroupArtifact { type: 'group'; name?: string; categoryValueRef?: string; } interface SequenceFlow { id: string; sources: [string]; targets: [string]; bpmn: SequenceFlowBpmn; labels?: Label[]; } interface SequenceFlowBpmn { type: 'sequenceFlow'; name?: string; conditionExpression?: FormalExpression; isDefault?: boolean; } interface MessageFlow { id: string; sources: [string]; targets: [string]; bpmn: MessageFlowBpmn; labels?: Label[]; } interface MessageFlowBpmn { type: 'messageFlow'; name?: string; messageRef?: string; } interface DataAssociation { id: string; sources: string[]; targets: string[]; bpmn: DataAssociationBpmn; } interface DataAssociationBpmn { type: 'dataInputAssociation' | 'dataOutputAssociation'; transformation?: { body?: string; }; assignment?: Array<{ from?: string; to?: string; }>; } interface FormalExpression { type?: string; language?: string; body?: string; } declare function isCollaboration(child: Collaboration | Process): child is Collaboration; declare function isProcess(child: Collaboration | Process): child is Process; declare function isLane(child: Lane | FlowNode): child is Lane; declare function isFlowNode(child: Lane | FlowNode): child is FlowNode; declare function isEvent(bpmn: FlowNode['bpmn']): bpmn is BpmnEvent; declare function isTask(bpmn: FlowNode['bpmn']): bpmn is BpmnTask; declare function isGateway(bpmn: FlowNode['bpmn']): bpmn is BpmnGateway; declare function isSubProcess(bpmn: FlowNode['bpmn']): bpmn is BpmnSubProcess; declare function isCallActivity(bpmn: FlowNode['bpmn']): bpmn is BpmnCallActivity; /** * BPMN Constants and Mappings */ declare const DEFAULT_SIZES: { readonly EVENT: { readonly width: 36; readonly height: 36; }; readonly TASK: { readonly width: 100; readonly height: 80; }; readonly TASK_WIDE: { readonly width: 120; readonly height: 80; }; readonly TASK_WIDER: { readonly width: 150; readonly height: 80; }; readonly GATEWAY: { readonly width: 50; readonly height: 50; }; readonly SUBPROCESS_COLLAPSED: { readonly width: 100; readonly height: 80; }; readonly SUBPROCESS_EXPANDED_MIN: { readonly width: 300; readonly height: 200; }; readonly DATA_OBJECT: { readonly width: 36; readonly height: 50; }; readonly DATA_STORE: { readonly width: 50; readonly height: 50; }; readonly TEXT_ANNOTATION: { readonly width: 100; readonly height: 30; }; }; declare const BPMN_ELEMENT_MAP: { readonly startEvent: "bpmn:StartEvent"; readonly endEvent: "bpmn:EndEvent"; readonly intermediateCatchEvent: "bpmn:IntermediateCatchEvent"; readonly intermediateThrowEvent: "bpmn:IntermediateThrowEvent"; readonly boundaryEvent: "bpmn:BoundaryEvent"; readonly task: "bpmn:Task"; readonly userTask: "bpmn:UserTask"; readonly serviceTask: "bpmn:ServiceTask"; readonly scriptTask: "bpmn:ScriptTask"; readonly businessRuleTask: "bpmn:BusinessRuleTask"; readonly sendTask: "bpmn:SendTask"; readonly receiveTask: "bpmn:ReceiveTask"; readonly manualTask: "bpmn:ManualTask"; readonly exclusiveGateway: "bpmn:ExclusiveGateway"; readonly parallelGateway: "bpmn:ParallelGateway"; readonly inclusiveGateway: "bpmn:InclusiveGateway"; readonly eventBasedGateway: "bpmn:EventBasedGateway"; readonly complexGateway: "bpmn:ComplexGateway"; readonly subProcess: "bpmn:SubProcess"; readonly transaction: "bpmn:Transaction"; readonly adHocSubProcess: "bpmn:AdHocSubProcess"; readonly eventSubProcess: "bpmn:SubProcess"; readonly callActivity: "bpmn:CallActivity"; readonly dataObject: "bpmn:DataObject"; readonly dataObjectReference: "bpmn:DataObjectReference"; readonly dataInput: "bpmn:DataInput"; readonly dataOutput: "bpmn:DataOutput"; readonly dataStoreReference: "bpmn:DataStoreReference"; readonly textAnnotation: "bpmn:TextAnnotation"; readonly group: "bpmn:Group"; readonly sequenceFlow: "bpmn:SequenceFlow"; readonly messageFlow: "bpmn:MessageFlow"; readonly dataInputAssociation: "bpmn:DataInputAssociation"; readonly dataOutputAssociation: "bpmn:DataOutputAssociation"; readonly association: "bpmn:Association"; readonly collaboration: "bpmn:Collaboration"; readonly participant: "bpmn:Participant"; readonly process: "bpmn:Process"; readonly lane: "bpmn:Lane"; readonly laneSet: "bpmn:LaneSet"; }; declare const EVENT_DEFINITION_MAP: { readonly none: null; readonly message: "bpmn:MessageEventDefinition"; readonly timer: "bpmn:TimerEventDefinition"; readonly error: "bpmn:ErrorEventDefinition"; readonly escalation: "bpmn:EscalationEventDefinition"; readonly cancel: "bpmn:CancelEventDefinition"; readonly compensation: "bpmn:CompensateEventDefinition"; readonly conditional: "bpmn:ConditionalEventDefinition"; readonly link: "bpmn:LinkEventDefinition"; readonly signal: "bpmn:SignalEventDefinition"; readonly terminate: "bpmn:TerminateEventDefinition"; readonly multiple: null; readonly parallelMultiple: null; }; declare const BPMN_NAMESPACES: { readonly bpmn: "http://www.omg.org/spec/BPMN/20100524/MODEL"; readonly bpmndi: "http://www.omg.org/spec/BPMN/20100524/DI"; readonly dc: "http://www.omg.org/spec/DD/20100524/DC"; readonly di: "http://www.omg.org/spec/DD/20100524/DI"; readonly xsi: "http://www.w3.org/2001/XMLSchema-instance"; readonly camunda: "http://camunda.org/schema/1.0/bpmn"; }; declare const DEFAULT_ELK_OPTIONS: { readonly 'elk.algorithm': "layered"; readonly 'elk.direction': "RIGHT"; readonly 'elk.spacing.nodeNode': 50; readonly 'elk.spacing.edgeNode': 30; readonly 'elk.spacing.edgeEdge': 20; readonly 'elk.layered.spacing.nodeNodeBetweenLayers': 80; readonly 'elk.layered.spacing.edgeNodeBetweenLayers': 30; readonly 'elk.hierarchyHandling': "INCLUDE_CHILDREN"; readonly 'elk.layered.crossingMinimization.strategy': "LAYER_SWEEP"; readonly 'elk.edgeRouting': "ORTHOGONAL"; }; declare const EVENT_TYPES: readonly ["startEvent", "endEvent", "intermediateCatchEvent", "intermediateThrowEvent", "boundaryEvent"]; declare const TASK_TYPES: readonly ["task", "userTask", "serviceTask", "scriptTask", "businessRuleTask", "sendTask", "receiveTask", "manualTask"]; declare const GATEWAY_TYPES: readonly ["exclusiveGateway", "parallelGateway", "inclusiveGateway", "eventBasedGateway", "complexGateway"]; declare const SUBPROCESS_TYPES: readonly ["subProcess", "transaction", "adHocSubProcess", "eventSubProcess"]; declare const ARTIFACT_TYPES: readonly ["dataObject", "dataObjectReference", "dataStoreReference", "textAnnotation", "group"]; /** * Group element type constant */ declare const GROUP_TYPE = "group"; /** * Set of artifact types for efficient lookup in layout processing. * Note: Excludes 'group' because groups are handled separately by GroupPositioner. */ declare const ARTIFACT_TYPES_SET: Set; declare const FLOW_TYPES: readonly ["sequenceFlow", "messageFlow", "dataInputAssociation", "dataOutputAssociation", "association"]; /** * Internal Types for Layout Processing * These types are used internally by the layout engine and are not part of the public API. */ /** * A point in 2D space */ interface Point$1 { x: number; y: number; } /** * A section of an edge with waypoints */ interface EdgeSection$1 { id: string; startPoint: Point$1; endPoint: Point$1; bendPoints?: Point$1[]; } /** * ELK Layout Output Types * Types for the result of ELK layout calculation (with coordinates) */ type Point = Point$1; interface EdgeSection extends EdgeSection$1 { incomingShape?: string; outgoingShape?: string; incomingSections?: string[]; outgoingSections?: string[]; } interface LayoutedGraph extends ElkBpmnGraph { x?: number; y?: number; width?: number; height?: number; children: (LayoutedCollaboration | LayoutedProcess)[]; } interface LayoutedCollaboration extends Omit { x?: number; y?: number; width?: number; height?: number; children: LayoutedParticipant[]; edges?: LayoutedMessageFlow[]; } interface LayoutedParticipant extends Omit { x: number; y: number; width: number; height: number; children?: (LayoutedLane | LayoutedFlowNode)[]; edges?: LayoutedSequenceFlow[]; } interface LayoutedLane extends Omit { x: number; y: number; width: number; height: number; children?: (LayoutedLane | LayoutedFlowNode)[]; } interface LayoutedProcess extends Omit { x?: number; y?: number; width?: number; height?: number; children?: (LayoutedLane | LayoutedFlowNode)[]; edges?: (LayoutedSequenceFlow | LayoutedDataAssociation)[]; artifacts?: LayoutedArtifact[]; } interface LayoutedFlowNode extends Omit { x: number; y: number; width: number; height: number; children?: LayoutedFlowNode[]; edges?: LayoutedSequenceFlow[]; boundaryEvents?: LayoutedBoundaryEvent[]; labels?: LayoutedLabel[]; } interface LayoutedBoundaryEvent extends Omit { x: number; y: number; width: number; height: number; labels?: LayoutedLabel[]; } interface LayoutedLabel extends Label { x: number; y: number; width: number; height: number; } interface LayoutedSequenceFlow extends Omit { sections: EdgeSection[]; labels?: LayoutedLabel[]; container?: string; } interface LayoutedMessageFlow extends Omit { sections: EdgeSection[]; labels?: LayoutedLabel[]; container?: string; } interface LayoutedDataAssociation extends DataAssociation { sections: EdgeSection[]; container?: string; } interface LayoutedArtifact extends Omit { x: number; y: number; width: number; height: number; labels?: LayoutedLabel[]; } /** * BpmnElkLayout - Main Converter Class * * Converts ELK-BPMN JSON to: * - BPMN 2.0 XML (with diagram interchange) * - Layouted ELK-BPMN JSON (with coordinates) */ interface BpmnElkLayoutOptions { /** * ELK layout options to override defaults */ elkOptions?: ElkLayoutOptions; /** * Enable layout compaction to reduce unnecessary whitespace * @default true */ enableCompaction?: boolean; } declare class BpmnElkLayout { private layouter; private modelBuilder; private xmlGenerator; constructor(options?: BpmnElkLayoutOptions); /** * Convert ELK-BPMN JSON to BPMN 2.0 XML * * @param input - ELK-BPMN JSON (without coordinates) * @returns BPMN 2.0 XML string with diagram interchange * * @example * ```typescript * const converter = new BpmnElkLayout(); * const xml = await converter.to_bpmn(elkBpmnJson); * console.log(xml); * ``` */ to_bpmn(input: ElkBpmnGraph): Promise; /** * Convert ELK-BPMN JSON to layouted JSON with coordinates * * @param input - ELK-BPMN JSON (without coordinates) * @returns ELK-BPMN JSON with x, y coordinates for all nodes and edges * * @example * ```typescript * const converter = new BpmnElkLayout(); * const layouted = await converter.to_json(elkBpmnJson); * console.log(layouted.children[0].x, layouted.children[0].y); * ``` */ to_json(input: ElkBpmnGraph): Promise; /** * Create a new instance with different options */ static create(options?: BpmnElkLayoutOptions): BpmnElkLayout; } export { ARTIFACT_TYPES, ARTIFACT_TYPES_SET, type Artifact, BPMN_ELEMENT_MAP, BPMN_NAMESPACES, type BoundaryEvent, type BpmnCallActivity, BpmnElkLayout, type BpmnElkLayoutOptions, type BpmnEvent, type BpmnGateway, type BpmnSubProcess, type BpmnTask, type Collaboration, type ConditionalEventDefinition, DEFAULT_ELK_OPTIONS, DEFAULT_SIZES, EVENT_DEFINITION_MAP, EVENT_TYPES, type EdgeSection, type ElkBpmnGraph, type ElkLayoutOptions, type ErrorDefinition, type EscalationDefinition, FLOW_TYPES, type FlowNode, GATEWAY_TYPES, GROUP_TYPE, type Lane, type LayoutedCollaboration, type LayoutedFlowNode, type LayoutedGraph, type LayoutedLane, type LayoutedMessageFlow, type LayoutedParticipant, type LayoutedProcess, type LayoutedSequenceFlow, type LinkEventDefinition, type LoopCharacteristics, type MessageDefinition, type MessageFlow, type Participant, type Point, type Process, SUBPROCESS_TYPES, type SequenceFlow, type SignalDefinition, TASK_TYPES, type TimerEventDefinition, isCallActivity, isCollaboration, isEvent, isFlowNode, isGateway, isLane, isProcess, isSubProcess, isTask };