@5minds/node-red-contrib-processcube 1.1.4-feature-3050c0-m04ysmbf → 1.1.4-feature-6a84d1-m0504qax
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "1.1.4-feature-
|
3
|
+
"version": "1.1.4-feature-6a84d1-m0504qax",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
6
|
"scripts": {
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"externaltaskOutput": "externaltask-output.js",
|
41
41
|
"externaltaskError": "externaltask-error.js",
|
42
42
|
"processStart": "process-start.js",
|
43
|
-
"
|
43
|
+
"processStartedListener": "process-started-listener.js",
|
44
44
|
"processcubeEngineConfig": "processcube-engine-config.js",
|
45
45
|
"ProcessinstanceQuery": "processinstance-query.js",
|
46
46
|
"ProcessdefinitionQuery": "processdefinition-query.js",
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<script type="text/javascript">
|
2
|
+
RED.nodes.registerType('process-finished-listener', {
|
3
|
+
category: 'ProcessCube',
|
4
|
+
color: '#02AFD6',
|
5
|
+
defaults: {
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
processmodel: { value: '', required: false },
|
9
|
+
},
|
10
|
+
inputs: 0,
|
11
|
+
outputs: 1,
|
12
|
+
icon: 'font-awesome/fa-sign-in',
|
13
|
+
label: function () {
|
14
|
+
return this.name || 'process-finished-listener';
|
15
|
+
},
|
16
|
+
});
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<script type="text/html" data-template-name="process-finished-listener">
|
20
|
+
<div class="form-row">
|
21
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
22
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
23
|
+
</div>
|
24
|
+
<div class="form-row">
|
25
|
+
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
26
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
27
|
+
</div>
|
28
|
+
<div class="form-row">
|
29
|
+
<label for="node-input-processmodel"><i class="fa fa-tag"></i> Processmodel</label>
|
30
|
+
<input type="text" id="node-input-processmodel" placeholder="ID of Processmodel" />
|
31
|
+
</div>
|
32
|
+
</script>
|
33
|
+
|
34
|
+
<script type="text/markdown" data-help-name="process-start">
|
35
|
+
Subscribe to process endings
|
36
|
+
</script>
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module.exports = function (RED) {
|
2
|
+
function ProcessFinishedListener(config) {
|
3
|
+
RED.nodes.createNode(this, config);
|
4
|
+
var node = this;
|
5
|
+
node.engine = RED.nodes.getNode(config.engine);
|
6
|
+
|
7
|
+
const register = async () => {
|
8
|
+
const client = node.engine.engineClient;
|
9
|
+
|
10
|
+
if (!client) {
|
11
|
+
node.error('No engine configured.');
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
let currentIdentity = node.engine.identity;
|
16
|
+
|
17
|
+
let subscription;
|
18
|
+
|
19
|
+
if (node.engine.isIdentityReady()) {
|
20
|
+
subscription = await client.notification.onProcessEnded(
|
21
|
+
(processNotification) => {
|
22
|
+
console.log(processNotification);
|
23
|
+
if (config.processmodel != processNotification.processModelId) return;
|
24
|
+
node.send({
|
25
|
+
payload: {
|
26
|
+
processInstanceId: processNotification.processInstanceId,
|
27
|
+
flowNodeId: processNotification.flowNodeId,
|
28
|
+
token: processNotification.currentToken,
|
29
|
+
action: 'started',
|
30
|
+
type: 'processInstance',
|
31
|
+
},
|
32
|
+
});
|
33
|
+
},
|
34
|
+
{ identity: currentIdentity }
|
35
|
+
);
|
36
|
+
}
|
37
|
+
|
38
|
+
node.engine.registerOnIdentityChanged(async (identity) => {
|
39
|
+
if (subscription) {
|
40
|
+
client.notification.removeSubscription(subscription, currentIdentity);
|
41
|
+
}
|
42
|
+
|
43
|
+
currentIdentity = identity;
|
44
|
+
|
45
|
+
subscription = await client.notification.onProcessEnded(
|
46
|
+
(processNotification) => {
|
47
|
+
if (config.processmodel != processNotification.processModelId) return;
|
48
|
+
node.send({
|
49
|
+
payload: {
|
50
|
+
processInstanceId: processNotification.processInstanceId,
|
51
|
+
flowNodeId: processNotification.flowNodeId,
|
52
|
+
token: processNotification.currentToken,
|
53
|
+
action: 'ended',
|
54
|
+
type: 'processInstance',
|
55
|
+
},
|
56
|
+
});
|
57
|
+
},
|
58
|
+
{ identity: currentIdentity }
|
59
|
+
);
|
60
|
+
});
|
61
|
+
|
62
|
+
node.on('close', () => {
|
63
|
+
if (node.engine && node.engine.engineClient && client) {
|
64
|
+
client.notification.removeSubscription(subscription, currentIdentity);
|
65
|
+
}
|
66
|
+
});
|
67
|
+
};
|
68
|
+
|
69
|
+
if (node.engine) {
|
70
|
+
register();
|
71
|
+
}
|
72
|
+
}
|
73
|
+
RED.nodes.registerType('process-ended-listener', ProcessEndedListener);
|
74
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('process-
|
2
|
+
RED.nodes.registerType('process-started-listener', {
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
@@ -11,12 +11,12 @@
|
|
11
11
|
outputs: 1,
|
12
12
|
icon: 'font-awesome/fa-sign-in',
|
13
13
|
label: function () {
|
14
|
-
return this.name || 'process-
|
14
|
+
return this.name || 'process-started-listener';
|
15
15
|
},
|
16
16
|
});
|
17
17
|
</script>
|
18
18
|
|
19
|
-
<script type="text/html" data-template-name="process-
|
19
|
+
<script type="text/html" data-template-name="process-started-listener">
|
20
20
|
<div class="form-row">
|
21
21
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
22
22
|
<input type="text" id="node-input-name" placeholder="Name" />
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module.exports = function (RED) {
|
2
|
+
function ProcessStartedListener(config) {
|
3
|
+
RED.nodes.createNode(this, config);
|
4
|
+
var node = this;
|
5
|
+
node.engine = RED.nodes.getNode(config.engine);
|
6
|
+
|
7
|
+
const register = async () => {
|
8
|
+
const client = node.engine.engineClient;
|
9
|
+
|
10
|
+
if (!client) {
|
11
|
+
node.error('No engine configured.');
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
let currentIdentity = node.engine.identity;
|
16
|
+
|
17
|
+
let subscription;
|
18
|
+
|
19
|
+
if (node.engine.isIdentityReady()) {
|
20
|
+
subscription = await client.notification.onProcessStarted(
|
21
|
+
(processNotification) => {
|
22
|
+
if (config.processmodel != processNotification.processModelId) return;
|
23
|
+
node.send({
|
24
|
+
payload: {
|
25
|
+
processInstanceId: processNotification.processInstanceId,
|
26
|
+
flowNodeId: processNotification.flowNodeId,
|
27
|
+
token: processNotification.currentToken,
|
28
|
+
action: 'started',
|
29
|
+
type: 'processInstance',
|
30
|
+
},
|
31
|
+
});
|
32
|
+
},
|
33
|
+
{ identity: currentIdentity }
|
34
|
+
);
|
35
|
+
}
|
36
|
+
|
37
|
+
node.engine.registerOnIdentityChanged(async (identity) => {
|
38
|
+
if (subscription) {
|
39
|
+
client.notification.removeSubscription(subscription, currentIdentity);
|
40
|
+
}
|
41
|
+
|
42
|
+
currentIdentity = identity;
|
43
|
+
|
44
|
+
subscription = await client.notification.onProcessStarted(
|
45
|
+
(processNotification) => {
|
46
|
+
if (config.processmodel != processNotification.processModelId) return;
|
47
|
+
node.send({
|
48
|
+
payload: {
|
49
|
+
processInstanceId: processNotification.processInstanceId,
|
50
|
+
flowNodeId: processNotification.flowNodeId,
|
51
|
+
token: processNotification.currentToken,
|
52
|
+
action: 'started',
|
53
|
+
type: 'processInstance',
|
54
|
+
},
|
55
|
+
});
|
56
|
+
},
|
57
|
+
{ identity: currentIdentity }
|
58
|
+
);
|
59
|
+
});
|
60
|
+
|
61
|
+
node.on('close', () => {
|
62
|
+
if (node.engine && node.engine.engineClient && client) {
|
63
|
+
client.notification.removeSubscription(subscription, currentIdentity);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
};
|
67
|
+
|
68
|
+
if (node.engine) {
|
69
|
+
register();
|
70
|
+
}
|
71
|
+
}
|
72
|
+
RED.nodes.registerType('process-started-listener', ProcessStartedListener);
|
73
|
+
};
|
package/process-new-listener.js
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
module.exports = function (RED) {
|
2
|
-
function ProcessNewListener(config) {
|
3
|
-
RED.nodes.createNode(this, config);
|
4
|
-
var node = this;
|
5
|
-
node.engine = RED.nodes.getNode(config.engine);
|
6
|
-
|
7
|
-
const register = async () => {
|
8
|
-
const client = node.engine.engineClient;
|
9
|
-
|
10
|
-
if (!client) {
|
11
|
-
node.error('No engine configured.');
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
|
15
|
-
let currentIdentity = node.engine.identity;
|
16
|
-
|
17
|
-
let subscription;
|
18
|
-
|
19
|
-
if (node.engine.isIdentityReady()) {
|
20
|
-
subscription = await client.notification.onProcessStarted(
|
21
|
-
(processNotification) => {
|
22
|
-
// node.send({
|
23
|
-
// payload: {
|
24
|
-
// flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
25
|
-
// userTaskEvent: userTaskWaitingNotification,
|
26
|
-
// action: 'new',
|
27
|
-
// type: 'usertask',
|
28
|
-
// },
|
29
|
-
// });
|
30
|
-
console.log(processNotification);
|
31
|
-
},
|
32
|
-
{ identity: currentIdentity }
|
33
|
-
);
|
34
|
-
}
|
35
|
-
|
36
|
-
node.engine.registerOnIdentityChanged(async (identity) => {
|
37
|
-
if (subscription) {
|
38
|
-
client.notifications.removeSubscription(subscription, currentIdentity);
|
39
|
-
}
|
40
|
-
|
41
|
-
currentIdentity = identity;
|
42
|
-
|
43
|
-
subscription = await client.notification.onProcessStarted(
|
44
|
-
(processNotification) => {
|
45
|
-
// node.send({
|
46
|
-
// payload: {
|
47
|
-
// flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
48
|
-
// userTaskEvent: userTaskWaitingNotification,
|
49
|
-
// action: 'new',
|
50
|
-
// type: 'usertask',
|
51
|
-
// },
|
52
|
-
// });
|
53
|
-
console.log(processNotification);
|
54
|
-
},
|
55
|
-
{ identity: currentIdentity }
|
56
|
-
);
|
57
|
-
});
|
58
|
-
|
59
|
-
node.on('close', () => {
|
60
|
-
if (node.engine && node.engine.engineClient && client) {
|
61
|
-
client.notifications.removeSubscription(subscription, currentIdentity);
|
62
|
-
}
|
63
|
-
});
|
64
|
-
};
|
65
|
-
|
66
|
-
if (node.engine) {
|
67
|
-
register();
|
68
|
-
}
|
69
|
-
}
|
70
|
-
RED.nodes.registerType('process-new-listener', ProcessNewListener);
|
71
|
-
};
|