moddle-context-serializer
TypeScript icon, indicating that this package has built-in type declarations

4.2.0 • Public • Published

bpmn-moddle context serializer

Make bpmn-moddle context serializable and mapped to behaviour functions

buildcoverage

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';

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;
}

Dependencies (0)

    Dev Dependencies (13)

    Package Sidebar

    Install

    npm i moddle-context-serializer

    Weekly Downloads

    1,570

    Version

    4.2.0

    License

    MIT

    Unpacked Size

    64 kB

    Total Files

    6

    Last publish

    Collaborators

    • paed01