@5minds/node-red-contrib-processcube 1.5.10-feature-b754b9-m4mtb82p → 1.5.10-feature-1657ec-m4r2pgad
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/endevent-finished-listener.js +36 -5
- package/externaltask-event-listener.js +35 -5
- package/externaltask-input.js +15 -3
- package/message-event-trigger.js +5 -3
- package/package.json +2 -2
- package/process-event-listener.js +396 -279
- package/process-start.js +3 -7
- package/process-terminate.js +3 -3
- package/processcube-engine-config.html +7 -7
- package/processcube-engine-config.js +122 -16
- package/processdefinition-query.js +28 -24
- package/processinstance-delete.html +56 -9
- package/processinstance-delete.js +31 -12
- package/processinstance-query.js +3 -3
- package/signal-event-trigger.js +4 -3
- package/usertask-event-listener.js +41 -7
- package/usertask-input.js +7 -3
- package/usertask-output.js +4 -4
- package/wait-for-usertask.js +44 -26
@@ -6,6 +6,17 @@ module.exports = function (RED) {
|
|
6
6
|
|
7
7
|
let subscription;
|
8
8
|
|
9
|
+
const engineEventEmitter = node.engine.eventEmitter;
|
10
|
+
|
11
|
+
engineEventEmitter.on('engine-client-dispose', () => {
|
12
|
+
node.engine.engineClient.notification.removeSubscription(subscription, node.engine.identity);
|
13
|
+
});
|
14
|
+
|
15
|
+
engineEventEmitter.on('engine-client-changed', () => {
|
16
|
+
node.log('new engineClient received');
|
17
|
+
register();
|
18
|
+
});
|
19
|
+
|
9
20
|
const register = async () => {
|
10
21
|
const client = node.engine.engineClient;
|
11
22
|
|
@@ -14,336 +25,442 @@ module.exports = function (RED) {
|
|
14
25
|
return;
|
15
26
|
}
|
16
27
|
|
28
|
+
let currentIdentity = node.engine.identity;
|
29
|
+
|
17
30
|
const query = RED.util.evaluateNodeProperty(config.query, config.query_type, node);
|
18
31
|
|
19
32
|
async function subscribe(eventType) {
|
20
33
|
switch (eventType) {
|
21
34
|
case 'starting':
|
22
|
-
return await client.notification.onProcessStarting(
|
23
|
-
|
24
|
-
config.processmodel != '' &&
|
25
|
-
config.processmodel != processNotification.processModelId
|
26
|
-
) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
|
30
|
-
const newQuery = {
|
31
|
-
processInstanceId: processNotification.processInstanceId,
|
32
|
-
...query,
|
33
|
-
};
|
34
|
-
|
35
|
-
try {
|
36
|
-
const matchingInstances = await client.processInstances.query(newQuery);
|
37
|
-
|
35
|
+
return await client.notification.onProcessStarting(
|
36
|
+
async (processNotification) => {
|
38
37
|
if (
|
39
|
-
|
40
|
-
|
38
|
+
config.processmodel != '' &&
|
39
|
+
config.processmodel != processNotification.processModelId
|
41
40
|
) {
|
42
|
-
|
43
|
-
node.send({
|
44
|
-
payload: {
|
45
|
-
processInstanceId: processNotification.processInstanceId,
|
46
|
-
processModelId: processNotification.processModelId,
|
47
|
-
processInstance: processInstance,
|
48
|
-
action: 'starting',
|
49
|
-
type: 'processInstance',
|
50
|
-
},
|
51
|
-
});
|
41
|
+
return;
|
52
42
|
}
|
53
|
-
} catch (error) {
|
54
|
-
node.error(JSON.stringify(error));
|
55
|
-
}
|
56
|
-
|
57
|
-
});
|
58
|
-
case 'started':
|
59
|
-
return await client.notification.onProcessStarted(async (processNotification) => {
|
60
|
-
if (
|
61
|
-
config.processmodel != '' &&
|
62
|
-
config.processmodel != processNotification.processModelId
|
63
|
-
) {
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
|
67
|
-
const newQuery = {
|
68
|
-
processInstanceId: processNotification.processInstanceId,
|
69
|
-
...query,
|
70
|
-
};
|
71
43
|
|
72
|
-
|
73
|
-
|
44
|
+
const newQuery = {
|
45
|
+
processInstanceId: processNotification.processInstanceId,
|
46
|
+
...query,
|
47
|
+
};
|
74
48
|
|
49
|
+
try {
|
50
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
51
|
+
identity: currentIdentity,
|
52
|
+
});
|
53
|
+
|
54
|
+
if (
|
55
|
+
matchingInstances.processInstances &&
|
56
|
+
matchingInstances.processInstances.length == 1
|
57
|
+
) {
|
58
|
+
const processInstance = matchingInstances.processInstances[0];
|
59
|
+
|
60
|
+
node.send({
|
61
|
+
payload: {
|
62
|
+
processInstanceId: processNotification.processInstanceId,
|
63
|
+
processModelId: processNotification.processModelId,
|
64
|
+
processInstance: processInstance,
|
65
|
+
action: 'starting',
|
66
|
+
type: 'processInstance',
|
67
|
+
},
|
68
|
+
});
|
69
|
+
}
|
70
|
+
} catch (error) {
|
71
|
+
node.error(JSON.stringify(error));
|
72
|
+
}
|
73
|
+
},
|
74
|
+
{ identity: currentIdentity }
|
75
|
+
);
|
76
|
+
case 'started':
|
77
|
+
return await client.notification.onProcessStarted(
|
78
|
+
async (processNotification) => {
|
75
79
|
if (
|
76
|
-
|
77
|
-
|
80
|
+
config.processmodel != '' &&
|
81
|
+
config.processmodel != processNotification.processModelId
|
78
82
|
) {
|
79
|
-
|
80
|
-
node.send({
|
81
|
-
payload: {
|
82
|
-
processInstanceId: processNotification.processInstanceId,
|
83
|
-
processModelId: processNotification.processModelId,
|
84
|
-
flowNodeId: processNotification.flowNodeId,
|
85
|
-
token: processNotification.currentToken,
|
86
|
-
processInstance: processInstance,
|
87
|
-
action: 'started',
|
88
|
-
type: 'processInstance',
|
89
|
-
},
|
90
|
-
});
|
83
|
+
return;
|
91
84
|
}
|
92
|
-
} catch (error) {
|
93
|
-
node.error(JSON.stringify(error));
|
94
|
-
}
|
95
|
-
});
|
96
|
-
case 'resumed':
|
97
|
-
return await client.notification.onProcessResumed(async (processNotification) => {
|
98
|
-
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
99
|
-
return;
|
100
85
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
86
|
+
const newQuery = {
|
87
|
+
processInstanceId: processNotification.processInstanceId,
|
88
|
+
...query,
|
89
|
+
};
|
105
90
|
|
106
|
-
|
107
|
-
|
91
|
+
try {
|
92
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
93
|
+
identity: currentIdentity,
|
94
|
+
});
|
108
95
|
|
96
|
+
if (
|
97
|
+
matchingInstances.processInstances &&
|
98
|
+
matchingInstances.processInstances.length == 1
|
99
|
+
) {
|
100
|
+
const processInstance = matchingInstances.processInstances[0];
|
101
|
+
node.send({
|
102
|
+
payload: {
|
103
|
+
processInstanceId: processNotification.processInstanceId,
|
104
|
+
processModelId: processNotification.processModelId,
|
105
|
+
flowNodeId: processNotification.flowNodeId,
|
106
|
+
token: processNotification.currentToken,
|
107
|
+
processInstance: processInstance,
|
108
|
+
action: 'started',
|
109
|
+
type: 'processInstance',
|
110
|
+
},
|
111
|
+
});
|
112
|
+
}
|
113
|
+
} catch (error) {
|
114
|
+
node.error(JSON.stringify(error));
|
115
|
+
}
|
116
|
+
},
|
117
|
+
{ identity: currentIdentity }
|
118
|
+
);
|
119
|
+
case 'resumed':
|
120
|
+
return await client.notification.onProcessResumed(
|
121
|
+
async (processNotification) => {
|
109
122
|
if (
|
110
|
-
|
111
|
-
|
112
|
-
)
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
+
config.processmodel != '' &&
|
124
|
+
config.processmodel != processNotification.processModelId
|
125
|
+
)
|
126
|
+
return;
|
127
|
+
|
128
|
+
const newQuery = {
|
129
|
+
processInstanceId: processNotification.processInstanceId,
|
130
|
+
...query,
|
131
|
+
};
|
132
|
+
|
133
|
+
try {
|
134
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
135
|
+
identity: currentIdentity,
|
123
136
|
});
|
137
|
+
|
138
|
+
if (
|
139
|
+
matchingInstances.processInstances &&
|
140
|
+
matchingInstances.processInstances.length == 1
|
141
|
+
) {
|
142
|
+
const processInstance = matchingInstances.processInstances[0];
|
143
|
+
node.send({
|
144
|
+
payload: {
|
145
|
+
processInstanceId: processNotification.processInstanceId,
|
146
|
+
processModelId: processNotification.processModelId,
|
147
|
+
token: processNotification.currentToken,
|
148
|
+
processInstance: processInstance,
|
149
|
+
action: 'resumed',
|
150
|
+
type: 'processInstance',
|
151
|
+
},
|
152
|
+
});
|
153
|
+
}
|
154
|
+
} catch (error) {
|
155
|
+
node.error(JSON.stringify(error));
|
124
156
|
}
|
125
|
-
}
|
126
|
-
|
127
|
-
|
128
|
-
});
|
157
|
+
},
|
158
|
+
{ identity: currentIdentity }
|
159
|
+
);
|
129
160
|
case 'finished':
|
130
|
-
return await client.notification.onProcessEnded(
|
131
|
-
|
132
|
-
return;
|
133
|
-
|
134
|
-
const newQuery = {
|
135
|
-
processInstanceId: processNotification.processInstanceId,
|
136
|
-
...query,
|
137
|
-
};
|
138
|
-
|
139
|
-
try {
|
140
|
-
const matchingInstances = await client.processInstances.query(newQuery);
|
141
|
-
|
161
|
+
return await client.notification.onProcessEnded(
|
162
|
+
async (processNotification) => {
|
142
163
|
if (
|
143
|
-
|
144
|
-
|
145
|
-
)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
},
|
164
|
+
config.processmodel != '' &&
|
165
|
+
config.processmodel != processNotification.processModelId
|
166
|
+
)
|
167
|
+
return;
|
168
|
+
|
169
|
+
const newQuery = {
|
170
|
+
processInstanceId: processNotification.processInstanceId,
|
171
|
+
...query,
|
172
|
+
};
|
173
|
+
|
174
|
+
try {
|
175
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
176
|
+
identity: currentIdentity,
|
157
177
|
});
|
178
|
+
|
179
|
+
if (
|
180
|
+
matchingInstances.processInstances &&
|
181
|
+
matchingInstances.processInstances.length == 1
|
182
|
+
) {
|
183
|
+
const processInstance = matchingInstances.processInstances[0];
|
184
|
+
node.send({
|
185
|
+
payload: {
|
186
|
+
processInstanceId: processNotification.processInstanceId,
|
187
|
+
processModelId: processNotification.processModelId,
|
188
|
+
flowNodeId: processNotification.flowNodeId,
|
189
|
+
token: processNotification.currentToken,
|
190
|
+
processInstance: processInstance,
|
191
|
+
action: 'finished',
|
192
|
+
type: 'processInstance',
|
193
|
+
},
|
194
|
+
});
|
195
|
+
}
|
196
|
+
} catch (error) {
|
197
|
+
node.error(JSON.stringify(error));
|
158
198
|
}
|
159
|
-
}
|
160
|
-
|
161
|
-
|
162
|
-
});
|
199
|
+
},
|
200
|
+
{ identity: currentIdentity }
|
201
|
+
);
|
163
202
|
case 'terminated':
|
164
|
-
return await client.notification.onProcessTerminated(
|
165
|
-
|
166
|
-
return;
|
167
|
-
|
168
|
-
const newQuery = {
|
169
|
-
processInstanceId: processNotification.processInstanceId,
|
170
|
-
...query,
|
171
|
-
};
|
172
|
-
|
173
|
-
try {
|
174
|
-
const matchingInstances = await client.processInstances.query(newQuery);
|
203
|
+
return await client.notification.onProcessTerminated(
|
204
|
+
async (processNotification) => {
|
175
205
|
if (
|
176
|
-
|
177
|
-
|
178
|
-
)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
206
|
+
config.processmodel != '' &&
|
207
|
+
config.processmodel != processNotification.processModelId
|
208
|
+
)
|
209
|
+
return;
|
210
|
+
|
211
|
+
const newQuery = {
|
212
|
+
processInstanceId: processNotification.processInstanceId,
|
213
|
+
...query,
|
214
|
+
};
|
215
|
+
|
216
|
+
try {
|
217
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
218
|
+
identity: currentIdentity,
|
189
219
|
});
|
220
|
+
if (
|
221
|
+
matchingInstances.processInstances &&
|
222
|
+
matchingInstances.processInstances.length == 1
|
223
|
+
) {
|
224
|
+
const processInstance = matchingInstances.processInstances[0];
|
225
|
+
node.send({
|
226
|
+
payload: {
|
227
|
+
processInstanceId: processNotification.processInstanceId,
|
228
|
+
processModelId: processNotification.processModelId,
|
229
|
+
token: processNotification.currentToken,
|
230
|
+
processInstance: processInstance,
|
231
|
+
action: 'terminated',
|
232
|
+
type: 'processInstance',
|
233
|
+
},
|
234
|
+
});
|
235
|
+
}
|
236
|
+
} catch (error) {
|
237
|
+
node.error(JSON.stringify(error));
|
190
238
|
}
|
191
|
-
}
|
192
|
-
|
193
|
-
|
194
|
-
});
|
239
|
+
},
|
240
|
+
{ identity: currentIdentity }
|
241
|
+
);
|
195
242
|
case 'error':
|
196
|
-
return await client.notification.onProcessError(
|
197
|
-
|
198
|
-
return;
|
199
|
-
|
200
|
-
const newQuery = {
|
201
|
-
processInstanceId: processNotification.processInstanceId,
|
202
|
-
...query,
|
203
|
-
};
|
204
|
-
|
205
|
-
try {
|
206
|
-
const matchingInstances = await client.processInstances.query(newQuery);
|
207
|
-
|
243
|
+
return await client.notification.onProcessError(
|
244
|
+
async (processNotification) => {
|
208
245
|
if (
|
209
|
-
|
210
|
-
|
211
|
-
)
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
246
|
+
config.processmodel != '' &&
|
247
|
+
config.processmodel != processNotification.processModelId
|
248
|
+
)
|
249
|
+
return;
|
250
|
+
|
251
|
+
const newQuery = {
|
252
|
+
processInstanceId: processNotification.processInstanceId,
|
253
|
+
...query,
|
254
|
+
};
|
255
|
+
|
256
|
+
try {
|
257
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
258
|
+
identity: currentIdentity,
|
222
259
|
});
|
260
|
+
|
261
|
+
if (
|
262
|
+
matchingInstances.processInstances &&
|
263
|
+
matchingInstances.processInstances.length == 1
|
264
|
+
) {
|
265
|
+
const processInstance = matchingInstances.processInstances[0];
|
266
|
+
node.send({
|
267
|
+
payload: {
|
268
|
+
processInstanceId: processNotification.processInstanceId,
|
269
|
+
processModelId: processNotification.processModelId,
|
270
|
+
token: processNotification.currentToken,
|
271
|
+
processInstance: processInstance,
|
272
|
+
action: 'error',
|
273
|
+
type: 'processInstance',
|
274
|
+
},
|
275
|
+
});
|
276
|
+
}
|
277
|
+
} catch (error) {
|
278
|
+
node.error(JSON.stringify(error));
|
223
279
|
}
|
224
|
-
}
|
225
|
-
|
226
|
-
|
227
|
-
});
|
280
|
+
},
|
281
|
+
{ identity: currentIdentity }
|
282
|
+
);
|
228
283
|
case 'owner-changed':
|
229
|
-
return await client.notification.onProcessOwnerChanged(
|
230
|
-
|
231
|
-
return;
|
232
|
-
|
233
|
-
const newQuery = {
|
234
|
-
processInstanceId: processNotification.processInstanceId,
|
235
|
-
...query,
|
236
|
-
};
|
237
|
-
|
238
|
-
try {
|
239
|
-
const matchingInstances = await client.processInstances.query(newQuery);
|
240
|
-
|
284
|
+
return await client.notification.onProcessOwnerChanged(
|
285
|
+
async (processNotification) => {
|
241
286
|
if (
|
242
|
-
|
243
|
-
|
244
|
-
)
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
287
|
+
config.processmodel != '' &&
|
288
|
+
config.processmodel != processNotification.processModelId
|
289
|
+
)
|
290
|
+
return;
|
291
|
+
|
292
|
+
const newQuery = {
|
293
|
+
processInstanceId: processNotification.processInstanceId,
|
294
|
+
...query,
|
295
|
+
};
|
296
|
+
|
297
|
+
try {
|
298
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
299
|
+
identity: currentIdentity,
|
254
300
|
});
|
301
|
+
|
302
|
+
if (
|
303
|
+
matchingInstances.processInstances &&
|
304
|
+
matchingInstances.processInstances.length == 1
|
305
|
+
) {
|
306
|
+
const processInstance = matchingInstances.processInstances[0];
|
307
|
+
node.send({
|
308
|
+
payload: {
|
309
|
+
processInstanceId: processNotification.processInstanceId,
|
310
|
+
processModelId: processNotification.processModelId,
|
311
|
+
processInstance: processInstance,
|
312
|
+
action: 'owner-changed',
|
313
|
+
type: 'processInstance',
|
314
|
+
},
|
315
|
+
});
|
316
|
+
}
|
317
|
+
} catch (error) {
|
318
|
+
node.error(JSON.stringify(error));
|
255
319
|
}
|
256
|
-
}
|
257
|
-
|
258
|
-
|
259
|
-
});
|
320
|
+
},
|
321
|
+
{ identity: currentIdentity }
|
322
|
+
);
|
260
323
|
case 'instances-deleted':
|
261
|
-
return await client.notification.onProcessInstancesDeleted(
|
262
|
-
|
263
|
-
return;
|
264
|
-
|
265
|
-
const newQuery = {
|
266
|
-
processInstanceId: processNotification.processInstanceId,
|
267
|
-
...query,
|
268
|
-
};
|
269
|
-
|
270
|
-
try {
|
271
|
-
const matchingInstances = await client.processInstances.query(newQuery);
|
272
|
-
|
324
|
+
return await client.notification.onProcessInstancesDeleted(
|
325
|
+
async (processNotification) => {
|
273
326
|
if (
|
274
|
-
|
275
|
-
|
276
|
-
)
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
327
|
+
config.processmodel != '' &&
|
328
|
+
config.processmodel != processNotification.processModelId
|
329
|
+
)
|
330
|
+
return;
|
331
|
+
|
332
|
+
const newQuery = {
|
333
|
+
processInstanceId: processNotification.processInstanceId,
|
334
|
+
...query,
|
335
|
+
};
|
336
|
+
|
337
|
+
try {
|
338
|
+
const matchingInstances = await client.processInstances.query(newQuery, {
|
339
|
+
identity: currentIdentity,
|
286
340
|
});
|
341
|
+
|
342
|
+
if (
|
343
|
+
matchingInstances.processInstances &&
|
344
|
+
matchingInstances.processInstances.length == 1
|
345
|
+
) {
|
346
|
+
const processInstance = matchingInstances.processInstances[0];
|
347
|
+
node.send({
|
348
|
+
payload: {
|
349
|
+
processInstanceId: processNotification.processInstanceId,
|
350
|
+
processModelId: processNotification.processModelId,
|
351
|
+
processInstance: processInstance,
|
352
|
+
action: 'instances-deleted',
|
353
|
+
type: 'processInstance',
|
354
|
+
},
|
355
|
+
});
|
356
|
+
}
|
357
|
+
} catch (error) {
|
358
|
+
node.error(JSON.stringify(error));
|
287
359
|
}
|
288
|
-
}
|
289
|
-
|
290
|
-
|
291
|
-
});
|
360
|
+
},
|
361
|
+
{ identity: currentIdentity }
|
362
|
+
);
|
292
363
|
case 'is-executable-changed':
|
293
|
-
return await client.notification.onProcessIsExecutableChanged(
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
364
|
+
return await client.notification.onProcessIsExecutableChanged(
|
365
|
+
(processNotification) => {
|
366
|
+
|
367
|
+
node.log('processNotification (is-executable-changed): ' + JSON.stringify(processNotification));
|
368
|
+
|
369
|
+
if (
|
370
|
+
config.processmodel != '' &&
|
371
|
+
config.processmodel != processNotification.processModelId
|
372
|
+
)
|
373
|
+
return;
|
374
|
+
node.send({
|
375
|
+
payload: {
|
376
|
+
processModelId: processNotification.processModelId,
|
377
|
+
action: 'is-executable-changed',
|
378
|
+
type: 'processModel',
|
379
|
+
},
|
380
|
+
});
|
381
|
+
},
|
382
|
+
{ identity: currentIdentity }
|
383
|
+
);
|
308
384
|
case 'deployed':
|
309
|
-
return await client.notification.onProcessDeployed(
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
385
|
+
return await client.notification.onProcessDeployed(
|
386
|
+
(processNotification) => {
|
387
|
+
|
388
|
+
node.log('processNotification (deployed): ' + JSON.stringify(processNotification));
|
389
|
+
|
390
|
+
if (
|
391
|
+
config.processmodel != '' &&
|
392
|
+
config.processmodel != processNotification.processModelId
|
393
|
+
)
|
394
|
+
return;
|
395
|
+
node.send({
|
396
|
+
payload: {
|
397
|
+
processModelId: processNotification.processModelId,
|
398
|
+
action: 'deployed',
|
399
|
+
type: 'processModel',
|
400
|
+
},
|
401
|
+
});
|
402
|
+
},
|
403
|
+
{ identity: currentIdentity }
|
404
|
+
);
|
322
405
|
case 'undeployed':
|
323
|
-
return await client.notification.onProcessUndeployed(
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
406
|
+
return await client.notification.onProcessUndeployed(
|
407
|
+
(processNotification) => {
|
408
|
+
|
409
|
+
node.log('processNotification (undeployed): ' + JSON.stringify(processNotification));
|
410
|
+
|
411
|
+
if (
|
412
|
+
config.processmodel != '' &&
|
413
|
+
config.processmodel != processNotification.processModelId
|
414
|
+
)
|
415
|
+
return;
|
416
|
+
node.send({
|
417
|
+
payload: {
|
418
|
+
processModelId: processNotification.processModelId,
|
419
|
+
action: 'undeployed',
|
420
|
+
type: 'processModel',
|
421
|
+
},
|
422
|
+
});
|
423
|
+
},
|
424
|
+
{ identity: currentIdentity }
|
425
|
+
);
|
336
426
|
default:
|
337
427
|
console.error('no such event: ' + eventType);
|
338
428
|
break;
|
339
429
|
}
|
340
430
|
}
|
341
431
|
|
342
|
-
|
432
|
+
if (node.engine.isIdentityReady()) {
|
433
|
+
subscription = await subscribe(config.eventtype);
|
434
|
+
}
|
435
|
+
|
436
|
+
node.engine.registerOnIdentityChanged(async (identity) => {
|
437
|
+
if (subscription) {
|
438
|
+
client.notification.removeSubscription(subscription, currentIdentity);
|
439
|
+
}
|
440
|
+
|
441
|
+
currentIdentity = identity;
|
442
|
+
|
443
|
+
subscription = await client.notification.onProcessResumed(
|
444
|
+
(processNotification) => {
|
445
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
446
|
+
return;
|
447
|
+
node.send({
|
448
|
+
payload: {
|
449
|
+
processInstanceId: processNotification.processInstanceId,
|
450
|
+
processModelId: processNotification.processModelId,
|
451
|
+
token: processNotification.currentToken,
|
452
|
+
action: 'resumed',
|
453
|
+
type: 'processInstance',
|
454
|
+
},
|
455
|
+
});
|
456
|
+
},
|
457
|
+
{ identity: currentIdentity }
|
458
|
+
);
|
459
|
+
});
|
343
460
|
|
344
461
|
node.on('close', () => {
|
345
462
|
if (node.engine && node.engine.engineClient && client) {
|
346
|
-
client.notification.removeSubscription(subscription);
|
463
|
+
client.notification.removeSubscription(subscription, currentIdentity);
|
347
464
|
}
|
348
465
|
});
|
349
466
|
};
|