Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cmmn-moddle

bpmn-io10.4kMIT5.0.0

A moddle wrapper for CMMN 1.1

cmmn, moddle, cmmn11, meta-model

readme

cmmn-moddle

Build Status

Read and write CMMN 1.1 diagram files in NodeJS and the browser.

cmmn-moddle uses the CMMN 1.1 meta-model to validate the input and produce correct CMMN 1.1 XML. The library is built on top of moddle and moddle-xml.

Usage

Get the library via npm package. Bundle it for the web using browserify or webpack.

var CmmnModdle = require('cmmn-moddle');

var moddle = new CmmnModdle();

var xmlStr =
  '<?xml version="1.0" encoding="UTF-8"?>' +
  '<cmmn:definitions xmlns:cmmn="http://www.omg.org/spec/CMMN/20150516/MODEL" id="empty-definitions" targetNamespace="http://bpmn.io/schema/cmmn">' +
  '</cmmn:definitions>';


moddle.fromXML(xmlStr, function(err, definitions) {

  // update id attribute
  definitions.set('id', 'NEW ID');

  // add a root element
  var cmmnCase = moddle.create('cmmn:Case', { id: 'MyCase_1' });
  definitions.get('cases').push(cmmnCase);

  moddle.toXML(definitions, function(err, xmlStrUpdated) {

    // xmlStrUpdated contains new id and the added process

  });

});

Resources

Building the Project

To run the test suite that includes XSD schema validation you must have a Java JDK installed and properly exposed through the JAVA_HOME variable.

Execute the test via

npm test

Perform a complete build of the library via

npm run all

License

Use under the terms of the MIT license.

changelog

Changelog

All notable changes to cmmn-moddle are documented here. We use semantic versioning for releases.

Unreleased

_Note: Yet to be released changes appear here._

5.0.0

Breaking Changes

  • FEAT: migrate to ES modules. Use esm or a ES module aware transpiler to consume this library.

4.0.0

  • FEAT: encode entities in body properties (rather than using CDATA escaping)

3.0.0

  • FIX: properly decode text entities
  • CHORE: improve error handling on invalid attributes
  • CHORE: drop lodash in favor of min-dash

...

Check git log for earlier history.