zeebe-bpmn-moddle
Advanced tools
Comparing version 0.7.1 to 0.8.0
@@ -9,2 +9,3 @@ 'use strict'; | ||
const zeebeServiceTaskProperties = [ 'zeebe:TaskDefinition', 'zeebe:Subscription', 'zeebe:TaskHeaders','zeebe:LoopCharacteristics','zeebe:Input' ]; | ||
@@ -27,5 +28,9 @@ function ZeebeModdleExtension(eventBus) { | ||
// check if property is allowed in parent | ||
// (1) check if property is allowed in parent | ||
if (isObject(property) && !isAllowedInParent(property, parent)) { | ||
return false; | ||
} | ||
// (2) check for specific scenarios | ||
if (!this.canHostServiceTaskLikeProperties(property, parent)) { | ||
return false; | ||
@@ -35,2 +40,16 @@ } | ||
ZeebeModdleExtension.prototype.canHostServiceTaskLikeProperties = function(property, parent) { | ||
if (isAllowedInZeebeServiceTask(property)) { | ||
var serviceTaskLike = getParent(parent, 'bpmn:IntermediateThrowEvent') || getParent(parent, 'bpmn:EndEvent'); | ||
if (serviceTaskLike) { | ||
return isMessageEvent(serviceTaskLike); | ||
} | ||
} | ||
return true; | ||
}; | ||
module.exports = ZeebeModdleExtension; | ||
@@ -79,2 +98,17 @@ | ||
return allowedIn.indexOf(WILDCARD) !== -1; | ||
} | ||
function isMessageEvent(event) { | ||
const eventDefinitions = event.get('eventDefinitions'); | ||
return eventDefinitions.some(function(def) { | ||
return is(def, 'bpmn:MessageEventDefinition'); | ||
}); | ||
} | ||
// check if property is allowed in ZeebeServiceTask but not for none events | ||
function isAllowedInZeebeServiceTask(property) { | ||
return zeebeServiceTaskProperties.some(function(propertyType) { | ||
return is(property, propertyType); | ||
}); | ||
} |
{ | ||
"name": "zeebe-bpmn-moddle", | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"description": "Zeebe moddle extensions for BPMN 2.0", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -16,3 +16,5 @@ { | ||
"bpmn:ScriptTask", | ||
"bpmn:SendTask" | ||
"bpmn:SendTask", | ||
"bpmn:EndEvent", | ||
"bpmn:IntermediateThrowEvent" | ||
], | ||
@@ -160,2 +162,7 @@ "properties": [ | ||
], | ||
"meta": { | ||
"allowedIn": [ | ||
"zeebe:ZeebeServiceTask" | ||
] | ||
}, | ||
"properties": [ | ||
@@ -162,0 +169,0 @@ { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
366
12175
6