UNPKG

bpmnlint

Version:

Validate your BPMN diagrams based on configurable lint rules

45 lines (33 loc) 956 B
const { is } = require('bpmnlint-utils'); const { annotateRule } = require('./helper'); /** * A rule that ensures that an Ad Hoc Sub Process is valid according to the BPMN spec: * * - No start or end events * - Every intermediate event has an outgoing sequence flow * * @type { import('../lib/types.js').RuleFactory } */ module.exports = function() { function check(node, reporter) { if (!is(node, 'bpmn:AdHocSubProcess')) { return; } const flowElements = node.flowElements || []; flowElements.forEach(function(flowElement) { if (is(flowElement, 'bpmn:StartEvent')) { reporter.report(flowElement.id, 'A <Start Event> is not allowed in <Ad Hoc Sub Process>'); } if (is(flowElement, 'bpmn:EndEvent')) { reporter.report(flowElement.id, 'An <End Event> is not allowed in <Ad Hoc Sub Process>'); } }); } return annotateRule('ad-hoc-sub-process', { check }); };