moddle-context-serializer
v4.2.1
Published
Make bpmn-moddle context serializable and mapped to behaviour functions
Downloads
18,366
Maintainers
Readme
bpmn-moddle context serializer
Make bpmn-moddle context serializable and mapped to behaviour functions
Documentation
The tests are the documentation. Hence, please study test
A basic example:
import { Serializer, TypeResolver } from 'moddle-context-serializer';
import BpmnModdle from 'bpmn-moddle';
import * as bpmnElementsBehaviour from 'bpmn-elements';
import EscalationEventDefinition from './mytypes/EscalationEventDefinition.js';
export async function getSerializedContext(source) {
const bpmnModdle = new BpmnModdle();
const moddleContext = await bpmnModdle.fromXML(source);
const typeResolver = TypeResolver(bpmnElementsBehaviour, extender);
return Serializer(moddleContext, typeResolver);
}
function extender(behaviourMapping) {
behaviourMapping['bpmn:EscalationEventDefinition'] = EscalationEventDefinition;
}