# moddle-context-serializer

> Make bpmn-moddle context serializable and mapped to behaviour functions

Latest version **6.0.2** (published 2026-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install moddle-context-serializer
pnpm add moddle-context-serializer
yarn add moddle-context-serializer
bun add moddle-context-serializer
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 6.0.2 |
| Published | 2026-08-11 |
| First published | 2019-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 85.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Author | Pål Edman |
| Maintainers | paed01 |
| Keywords | bpmn, bpmn 2, serializable, deserializable, isomorphic |

## Links

- npm: https://www.npmjs.com/package/moddle-context-serializer
- Repository: https://github.com/paed01/moddle-context-serializer
- Homepage: https://github.com/paed01/moddle-context-serializer#readme
- Issues: https://github.com/paed01/moddle-context-serializer/issues
- npm.io page: https://npm.io/package/moddle-context-serializer

## Recent versions

- 6.0.2 (latest) — 2026-08-11
- 6.0.1 — 2026-06-14
- 6.0.0 — 2026-06-06
- 5.0.0 — 2026-05-09
- 4.4.1 — 2025-11-13
- 4.4.0 — 2025-04-30
- 4.3.0 — 2025-03-20
- 4.2.1 — 2024-08-02
- 4.2.0 — 2024-04-08
- 4.1.2 — 2024-02-11
- 4.1.1 — 2023-11-17
- 4.1.0 — 2023-07-19
- 4.0.0 — 2023-06-10
- 3.2.2 — 2023-03-24
- 3.2.1 — 2023-03-23
- … 31 more at https://npm.io/package/moddle-context-serializer/versions

## README

# bpmn-moddle context serializer

Make bpmn-moddle context serializable and mapped to behaviour functions

[![build](https://github.com/paed01/moddle-context-serializer/actions/workflows/build.yaml/badge.svg)](https://github.com/paed01/moddle-context-serializer/actions/workflows/build.yaml)[![coverage](https://coveralls.io/repos/github/paed01/moddle-context-serializer/badge.svg?branch=master)](https://coveralls.io/github/paed01/moddle-context-serializer?branch=master)

- [API](/API.md)

# Documentation

The tests are the documentation. Hence, please study [test](/test/serializer-test.js)

A basic example:

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

---
_Source: https://npm.io/package/moddle-context-serializer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
