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

bpmn-js-token-simulation

Package Overview
Dependencies
Maintainers
9
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpmn-js-token-simulation - npm Package Compare versions

Comparing version 0.25.0-0 to 0.25.0

28

CHANGELOG.md

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

## 0.25.0
* `FEAT`: rewrite simulator using event scopes and subscriptions ([#101](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/101))
* `FEAT`: support event rethrow and "absorption" ([#100](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/100))
* `FEAT`: trigger all startable elements inside `bpmn:SubProcess` ([#107](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/107), [`acdae242`](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/107/commits/acdae242d72e36a35e9e31d70c13fbcdd1c168b6))
* `FEAT`: support transactions and cancel events ([#76](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/76), [#102](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/102), [`5026298b`](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/102/commits/5026298b21699f0110b4e9d530dfca555e26ab8a))
* `FEAT`: support compensation ([#76](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/76), [#102](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/102), [`bcdad034`](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/102/commits/bcdad034d5b8e0fae0de2ad638136dd27b78c729))
* `FEAT`: eagerly interrupt when entering event sub-process ([`452ce5ec`](https://github.com/bpmn-io/bpmn-js-token-simulation/commit/452ce5eca78aeca849514a6f0e8782ce1bdf8b41))
* `FEAT`: add `Simulator` APIs for (BPMN) event triggering and subscriptions ([`5da21ed8`](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/101/commits/5da21ed8d66446b3e91090361086ab9b8d1000f9))
* `FEAT`: add `Simulator#waitForScopes` API ([`e23e57f0`](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/102/commits/e23e57f0d7aadbda2fc2d8599e10a90d817f91e5))
* `FIX`: don't allow pause on event sub-process ([`af04910b`](https://github.com/bpmn-io/bpmn-js-token-simulation/commit/af04910b60ede5fa2ab0dd43818940dca71ec364))
* `FIX`: correct pause handling on receive tasks ([#99](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/99))
* `FIX`: ensure technically _equal_ events can still be signaled individually ([#103](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/103), [#107](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/107) [`15d14062`](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/107/commits/15d140624b30835b6fff4bc1bbd93207f0afe226))
* `CHORE`: implement termination as a behavior ([`e92e8ff8`](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/101/commits/e92e8ff830a00803702f80f4f04be966fc5999b5))
* `CHORE`: remove destroyed scopes ([`b3662dc8`](https://github.com/bpmn-io/bpmn-js-token-simulation/commit/b3662dc8aeed8c5e34441e41c77ee7a6b06d0066))
* `CHORE`: namespace CSS ([#30](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/30))
* `CHORE`: add properties panel to example ([104](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/104))
* `DEPS`: update to `bpmn-js@8.9.0`
### Breaking Changes
* Generated markup and used CSS classes changed; things are consistently prefixed with `bts` now to avoid foreign classes crashing ([#30](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/30))
* Drop `destroyContext` in favor of dedicated scope state (failed/ended) ([#101](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/101))
* Reworked way the outside interacts with the simulator: Rather than signaling the simulator with knowledge of internal working mechanisms you trigger an event on a particular scope, notifying all registered subscribers. ([#101](https://github.com/bpmn-io/bpmn-js-token-simulation/pull/101))
* Destroyed scopes are now longer kept around by simulator ([`b3662dc8`](https://github.com/bpmn-io/bpmn-js-token-simulation/commit/b3662dc8aeed8c5e34441e41c77ee7a6b06d0066))
## 0.24.0

@@ -15,3 +41,3 @@

* `FEAT`: support token sinks other than end events ([#94](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/94))
* `FEAT`: support error throw events ([`017aa885`](https://github.com/bpmn-io/bpmn-js-token-simulation/commit/017aa885822ad84368ed16730057dd8907407d53)
* `FEAT`: support error throw events ([`017aa885`](https://github.com/bpmn-io/bpmn-js-token-simulation/commit/017aa885822ad84368ed16730057dd8907407d53))
* `FIX`: read and restore colors in `bpmn-js >= 8.7` compatible manner ([#90](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/90))

@@ -18,0 +44,0 @@ * `FIX`: correct context-pads interaction with scope filters ([`6dc14819`](https://github.com/bpmn-io/bpmn-js-token-simulation/commit/6dc14819384ae87df49ad058964185ef06216ea5))

17

lib/simulator/behaviors/ProcessBehavior.js

@@ -1,6 +0,1 @@

import {
is
} from '../util/ModelUtil';
export default function ProcessBehavior(

@@ -20,4 +15,3 @@ simulator,

const {
element,
startEvent = findProcessStart(element),
startEvent,
scope

@@ -52,9 +46,2 @@ } = context;

'scopeBehavior'
];
// helpers //////////////////
function findProcessStart(element) {
return element.children.find(child => is(child, 'bpmn:StartEvent'));
}
];
import {
is,
isAny,
isCompensationActivity,
isEventSubProcess,
isInterrupting
isInterrupting,
isLabel
} from '../util/ModelUtil';

@@ -70,12 +73,19 @@

element,
startEvent = findSubProcessStart(element),
startEvent,
scope
} = context;
if (!startEvent) {
throw new Error('missing <startEvent>');
const targetScope = scope.parent;
if (isEventSubProcess(element)) {
if (!startEvent) {
throw new Error('missing <startEvent>: required for event sub-process');
}
} else {
if (startEvent) {
throw new Error('unexpected <startEvent>: not allowed for sub-process');
}
}
const targetScope = scope.parent;
if (targetScope.destroyed) {

@@ -89,13 +99,15 @@ throw new Error(`target scope <${targetScope.id}> destroyed`);

const cancelActivity = isEventSubProcess(element) && isInterrupting(startEvent);
if (cancelActivity) {
if (startEvent && isInterrupting(startEvent)) {
this._scopeBehavior.interrupt(targetScope, scope);
}
this._simulator.signal({
element: startEvent,
parentScope: scope,
initiator: scope
});
const startEvents = startEvent ? [ startEvent ] : findSubProcessStarts(element);
for (const element of startEvents) {
this._simulator.signal({
element,
parentScope: scope,
initiator: scope
});
}
};

@@ -105,4 +117,29 @@

function findSubProcessStart(element) {
return element.children.find(child => is(child, 'bpmn:StartEvent'));
function findSubProcessStarts(element) {
return element.children.filter(child => {
if (isLabel(child)) {
return false;
}
const incoming = child.incoming.find(c => is(c, 'bpmn:SequenceFlow'));
if (incoming) {
return false;
}
if (isCompensationActivity(child)) {
return false;
}
if (isEventSubProcess(child)) {
return false;
}
return isAny(child, [
'bpmn:Activity',
'bpmn:StartEvent',
'bpmn:EndEvent'
]);
});
}

@@ -109,0 +146,0 @@

@@ -175,2 +175,3 @@ import {

element: compensateEventSub,
startEvent,
parentScope: scope

@@ -177,0 +178,0 @@ });

@@ -16,2 +16,3 @@ import Ids from 'ids';

import {
getBusinessObject,
is,

@@ -280,2 +281,14 @@ isAny,

function createInternalRef(element) {
if (
is(element, 'bpmn:StartEvent') ||
is(element, 'bpmn:IntermediateCatchEvent') ||
is(element, 'bpmn:ReceiveTask')
) {
return getBusinessObject(element).name || element.id;
}
return null;
}
function getEvent(element) {

@@ -288,14 +301,17 @@

if (is(element, 'bpmn:ReceiveTask')) {
return {
element,
type: 'message',
interrupting: false,
boundary: false
};
}
const interrupting = isInterrupting(element);
const boundary = is(element, 'bpmn:BoundaryEvent');
const boundary = isBoundaryEvent(element);
// we do create an internal reference for
// catch-like events to ensure these can
// be triggered via the UI exclusively
const iref = createInternalRef(element);
const baseEvent = {
element,
interrupting,
boundary,
...(iref ? { iref } : {})
};
const eventDefinition = (element.businessObject.eventDefinitions || {})[0];

@@ -305,16 +321,5 @@

if (element.incoming.some(element => is(element, 'bpmn:MessageFlow'))) {
return {
element,
type: 'message',
interrupting,
boundary
};
}
return {
element,
type: 'none',
interrupting,
boundary
...baseEvent,
type: isImplicitMessageCatch(element) ? 'message' : 'none'
};

@@ -325,3 +330,3 @@ }

return {
element,
...baseEvent,
type: 'link',

@@ -334,7 +339,5 @@ name: eventDefinition.name

return {
element,
...baseEvent,
type: 'signal',
ref: eventDefinition.signalRef,
interrupting,
boundary
ref: eventDefinition.signalRef
};

@@ -345,6 +348,4 @@ }

return {
element,
type: 'timer',
interrupting,
boundary
...baseEvent,
type: 'timer'
};

@@ -355,6 +356,4 @@ }

return {
element,
...baseEvent,
type: 'condition',
interrupting,
boundary
};

@@ -365,7 +364,5 @@ }

return {
element,
...baseEvent,
type: 'escalation',
ref: eventDefinition.escalationRef,
interrupting,
boundary
ref: eventDefinition.escalationRef
};

@@ -376,6 +373,4 @@ }

return {
element,
type: 'cancel',
interrupting,
boundary
...baseEvent,
type: 'cancel'
};

@@ -386,7 +381,5 @@ }

return {
element,
...baseEvent,
type: 'error',
ref: eventDefinition.errorRef,
interrupting,
boundary
ref: eventDefinition.errorRef
};

@@ -397,7 +390,5 @@ }

return {
element,
...baseEvent,
type: 'message',
ref: eventDefinition.messageRef,
interrupting,
boundary
ref: eventDefinition.messageRef
};

@@ -430,8 +421,6 @@ }

return {
element,
...baseEvent,
type: 'compensate',
ref,
persistent: true,
interrupting,
boundary
persistent: true
};

@@ -671,3 +660,3 @@ }

...getEvent(startEvent),
interrupting: false
persistent: true
};

@@ -868,2 +857,6 @@

);
}
function isImplicitMessageCatch(element) {
return is(element, 'bpmn:ReceiveTask') || element.incoming.some(element => is(element, 'bpmn:MessageFlow'));
}
export function eventsMatch(a, b) {
return [ 'type', 'name', 'ref' ].every(attr => !(attr in a) || a[attr] === b[attr]);
return [ 'type', 'name', 'ref', 'iref' ].every(attr => !(attr in a) || a[attr] === b[attr]);
}
{
"name": "bpmn-js-token-simulation",
"version": "0.25.0-0",
"version": "0.25.0",
"description": "bpmn-js token simulation extension",

@@ -5,0 +5,0 @@ "main": "index.js",

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