Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bpmn-io/dmn-migrate

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bpmn-io/dmn-migrate - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

6

CHANGELOG.md

@@ -9,2 +9,8 @@ # Changelog

## 0.3.0
* `FEAT`: support migration from DMN 1.2 to DMN 1.3
* `CHORE`: moved cli to `bpmn-io/dmn-migrate-cli`
* `CHORE`: simplify API
## 0.1.1

@@ -11,0 +17,0 @@

28

dist/index.esm.js

@@ -61,4 +61,5 @@ import DmnModdle from 'dmn-moddle';

const DMN11URI = '"http://www.omg.org/spec/DMN/20151101/dmn.xsd"',
DMN13URI = '"https://www.omg.org/spec/DMN/20191111/MODEL/"';
const DMN11URI = '"http://www.omg.org/spec/DMN/20151101/dmn.xsd"';
const DMN12URI = '"http://www.omg.org/spec/DMN/20180521/MODEL/"';
const DMN13URI = '"https://www.omg.org/spec/DMN/20191111/MODEL/"';

@@ -73,5 +74,7 @@

*/
function migrateTo13(xml) {
function migrateDiagram(xml) {
if (hasNamespace(DMN11URI, xml)) {
if (hasNamespace(DMN12URI, xml)) {
return migrateFrom12To13(xml);
} else if (hasNamespace(DMN11URI, xml)) {
return migrateFrom11To13(xml);

@@ -104,2 +107,17 @@ } else if (hasNamespace(DMN13URI, xml)) {

*/
function migrateFrom12To13(xml) {
return new Promise(resolve => resolve(
xml
.replace(DMN12URI, DMN13URI)
.replace('"http://www.omg.org/spec/DMN/20180521/DMNDI/"', '"https://www.omg.org/spec/DMN/20191111/DMNDI/"')
));
}
/**
* Migrate DMN 1.1 XML to 1.3.
*
* @param {string} xml
*
* @returns {string}
*/
function migrateFrom11To13(xml) {

@@ -373,2 +391,2 @@ return new Promise((resolve, reject) => {

export { migrateTo13 };
export { migrateDiagram };

@@ -67,4 +67,5 @@ 'use strict';

const DMN11URI = '"http://www.omg.org/spec/DMN/20151101/dmn.xsd"',
DMN13URI = '"https://www.omg.org/spec/DMN/20191111/MODEL/"';
const DMN11URI = '"http://www.omg.org/spec/DMN/20151101/dmn.xsd"';
const DMN12URI = '"http://www.omg.org/spec/DMN/20180521/MODEL/"';
const DMN13URI = '"https://www.omg.org/spec/DMN/20191111/MODEL/"';

@@ -79,5 +80,7 @@

*/
function migrateTo13(xml) {
function migrateDiagram(xml) {
if (hasNamespace(DMN11URI, xml)) {
if (hasNamespace(DMN12URI, xml)) {
return migrateFrom12To13(xml);
} else if (hasNamespace(DMN11URI, xml)) {
return migrateFrom11To13(xml);

@@ -110,2 +113,17 @@ } else if (hasNamespace(DMN13URI, xml)) {

*/
function migrateFrom12To13(xml) {
return new Promise(resolve => resolve(
xml
.replace(DMN12URI, DMN13URI)
.replace('"http://www.omg.org/spec/DMN/20180521/DMNDI/"', '"https://www.omg.org/spec/DMN/20191111/DMNDI/"')
));
}
/**
* Migrate DMN 1.1 XML to 1.3.
*
* @param {string} xml
*
* @returns {string}
*/
function migrateFrom11To13(xml) {

@@ -379,2 +397,2 @@ return new Promise((resolve, reject) => {

exports.migrateTo13 = migrateTo13;
exports.migrateDiagram = migrateDiagram;

16

package.json
{
"name": "@bpmn-io/dmn-migrate",
"version": "0.2.0",
"description": "Migrate DMN diagrams from one version of the standard to another.",
"version": "0.3.0",
"description": "Migrate DMN diagrams to the latest DMN standard.",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"source": "src/migrateDiagram.js",
"bin": "bin/migrate",
"scripts": {

@@ -16,4 +15,3 @@ "build": "rollup -c",

"test:build": "mocha --reporter=spec --recursive test/distro",
"test:integration": "mocha --reporter=spec --recursive test/integration",
"all": "run-s lint test distro test:integration"
"all": "run-s lint test distro"
},

@@ -36,11 +34,6 @@ "repository": {

"license": "MIT",
"bugs": {
"url": "https://github.com/bpmn-io/dmn-migrate/issues"
},
"homepage": "https://github.com/bpmn-io/dmn-migrate#readme",
"dependencies": {
"dmn-moddle": "^8.0.0",
"ids": "^1.0.0",
"min-dash": "^3.5.2",
"mri": "^1.1.4"
"min-dash": "^3.5.2"
},

@@ -50,3 +43,2 @@ "devDependencies": {

"chai": "^4.2.0",
"del": "^5.1.0",
"eslint": "^6.8.0",

@@ -53,0 +45,0 @@ "eslint-plugin-bpmn-io": "^0.10.0",

@@ -5,30 +5,17 @@ # dmn-migrate

Migrate DMN diagrams from one version of the standard to another (e.g. DMN 1.1 to 1.3).
Migrate your DMN diagrams to the latest DMN version (currently __DMN 1.3__).
Currently supported migration paths:
* DMN 1.1 to DMN 1.3
## Usage
### Through command line interface
```javascript
const { migrateDiagram } = require('@bpmn-io/dmn-migrate');
```bash
dmn-migrate -i ./dmn11.dmn -o ./dmn13.dmn
# or
dmn-migrate --input ./dmn11.dmn --output ./dmn13.dmn
const migratedXML = await migrateDiagram(dmn11XML);
```
### Through JavaScript API
## See also
```javascript
const { migrateTo13 } = require('@bpmn-io/dmn-migrate');
* [dmn-migrate-cli](https://github.com/bpmn-io/dmn-migrate-cli) - migrate your DMN diagrams from the command line
migrateTo13(dmn11XML)
.then(dmn13XML => {
// ...
});
```

@@ -35,0 +22,0 @@ ## License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc