Socket
Socket
Sign inDemoInstall

bpmn-moddle

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpmn-moddle - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

33

lib/id-support.js
'use strict';
var ID_PATTERN = /^(.*:)?id$/;
/**

@@ -26,26 +28,29 @@ * Extends the bpmn instance with id support.

model.ids = ids;
var set = model.properties.set;
var ID_PATTERN = /^(.*:)?id$/;
// do not reinitialize setter
// unless it is already initialized
if (!model.ids) {
model.properties.set = function(target, property, value) {
model.properties.set = function(target, property, value) {
// ensure we log used ids once they are assigned
// to model elements
if (ID_PATTERN.test(property)) {
// ensure we log used ids once they are assigned
// to model elements
if (ID_PATTERN.test(property)) {
var assigned = ids.assigned(value);
if (assigned && assigned !== target) {
throw new Error('id <' + value + '> already used');
var assigned = model.ids.assigned(value);
if (assigned && assigned !== target) {
throw new Error('id <' + value + '> already used');
}
model.ids.claim(value, target);
}
ids.claim(value, target);
}
set.call(this, target, property, value);
};
}
set.call(this, target, property, value);
};
model.ids = ids;
return model;
};
{
"name": "bpmn-moddle",
"version": "0.8.0",
"version": "0.8.1",
"description": "A moddle wrapper for BPMN 2.0",

@@ -5,0 +5,0 @@ "scripts": {

@@ -25,2 +25,5 @@ 'use strict';

this.timeout(15000);
it('inputOutput', function(done) {

@@ -27,0 +30,0 @@

@@ -59,3 +59,3 @@ 'use strict';

// when
var serviceTask = moddle.create('bpmn:ServiceTask', {
moddle.create('bpmn:ServiceTask', {
id: 'ServiceTask_1'

@@ -73,4 +73,27 @@ });

it('should reset and allow reclaim of ids', function() {
// given
var moddle = Helper.createModdle();
IdSupport.extend(moddle, new Ids());
moddle.create('bpmn:ServiceTask', {
id: 'ServiceTask_1'
});
// when
IdSupport.extend(moddle, new Ids());
// then
// expect id to have been reset
expect(function() {
moddle.create('bpmn:ServiceTask', {
id: 'ServiceTask_1'
});
}).not.to.throw();
});
});
});
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