@5minds/node-red-contrib-processcube 0.14.0-feature-7cec87-lyytfjz9 → 0.14.0-fix-error-in-process-instance-query-9aeac9-lyzi0gix

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/.prettierrc.json +6 -0
  2. package/Dockerfile +1 -1
  3. package/docker-compose.yml +0 -12
  4. package/externaltask-error.html +12 -26
  5. package/externaltask-error.js +20 -19
  6. package/externaltask-input.html +14 -31
  7. package/externaltask-input.js +55 -107
  8. package/externaltask-output.html +10 -20
  9. package/externaltask-output.js +11 -12
  10. package/message-event-trigger.html +14 -14
  11. package/message-event-trigger.js +21 -25
  12. package/nodered/node-red-contrib-processcube-flows.json +132 -216
  13. package/nodered/package.json +0 -1
  14. package/nodered/settings.js +82 -92
  15. package/package.json +9 -3
  16. package/process-start.html +19 -23
  17. package/process-start.js +18 -18
  18. package/processcube-engine-config.html +10 -10
  19. package/processcube-engine-config.js +22 -30
  20. package/processdefinition-query.html +29 -23
  21. package/processdefinition-query.js +12 -16
  22. package/processes/CheckError.bpmn +78 -0
  23. package/processes/NodeRedExternalTask.bpmn +77 -0
  24. package/processes/SampleUserTask.bpmn +95 -0
  25. package/processinstance-query.html +19 -20
  26. package/processinstance-query.js +17 -12
  27. package/signal-event-trigger.html +14 -14
  28. package/signal-event-trigger.js +21 -25
  29. package/usertask-finished-listener.html +17 -12
  30. package/usertask-finished-listener.js +34 -16
  31. package/usertask-input.html +40 -27
  32. package/usertask-input.js +19 -18
  33. package/usertask-new-listener.html +17 -12
  34. package/usertask-new-listener.js +35 -18
  35. package/usertask-output.html +23 -24
  36. package/usertask-output.js +12 -12
  37. package/examples/External-Task-Sample.json +0 -252
  38. package/processes/External-Task-Sample.bpmn +0 -94
@@ -21,15 +21,14 @@
21
21
  **/
22
22
 
23
23
  module.exports = {
24
-
25
- /*******************************************************************************
26
- * Flow File and User Directory Settings
27
- * - flowFile
28
- * - credentialSecret
29
- * - flowFilePretty
30
- * - userDir
31
- * - nodesDir
32
- ******************************************************************************/
24
+ /*******************************************************************************
25
+ * Flow File and User Directory Settings
26
+ * - flowFile
27
+ * - credentialSecret
28
+ * - flowFilePretty
29
+ * - userDir
30
+ * - nodesDir
31
+ ******************************************************************************/
33
32
 
34
33
  /** The file containing the flows. If not set, defaults to flows_<hostname>.json **/
35
34
  flowFile: 'flows.json',
@@ -41,7 +40,7 @@ module.exports = {
41
40
  * node-red from being able to decrypt your existing credentials and they will be
42
41
  * lost.
43
42
  */
44
- credentialSecret: "a-secret-key",
43
+ credentialSecret: 'a-secret-key',
45
44
 
46
45
  /** By default, the flow JSON will be formatted over multiple lines making
47
46
  * it easier to compare changes when using version control.
@@ -60,15 +59,15 @@ module.exports = {
60
59
  */
61
60
  //nodesDir: '/home/nol/.node-red/nodes',
62
61
 
63
- /*******************************************************************************
64
- * Security
65
- * - adminAuth
66
- * - https
67
- * - httpsRefreshInterval
68
- * - requireHttps
69
- * - httpNodeAuth
70
- * - httpStaticAuth
71
- ******************************************************************************/
62
+ /*******************************************************************************
63
+ * Security
64
+ * - adminAuth
65
+ * - https
66
+ * - httpsRefreshInterval
67
+ * - requireHttps
68
+ * - httpNodeAuth
69
+ * - httpStaticAuth
70
+ ******************************************************************************/
72
71
 
73
72
  /** To password protect the Node-RED editor and admin API, the following
74
73
  * property can be used. See https://nodered.org/docs/security.html for details.
@@ -125,20 +124,20 @@ module.exports = {
125
124
  //httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
126
125
  //httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
127
126
 
128
- /*******************************************************************************
129
- * Server Settings
130
- * - uiPort
131
- * - uiHost
132
- * - apiMaxLength
133
- * - httpServerOptions
134
- * - httpAdminRoot
135
- * - httpAdminMiddleware
136
- * - httpNodeRoot
137
- * - httpNodeCors
138
- * - httpNodeMiddleware
139
- * - httpStatic
140
- * - httpStaticRoot
141
- ******************************************************************************/
127
+ /*******************************************************************************
128
+ * Server Settings
129
+ * - uiPort
130
+ * - uiHost
131
+ * - apiMaxLength
132
+ * - httpServerOptions
133
+ * - httpAdminRoot
134
+ * - httpAdminMiddleware
135
+ * - httpNodeRoot
136
+ * - httpNodeCors
137
+ * - httpNodeMiddleware
138
+ * - httpStatic
139
+ * - httpStaticRoot
140
+ ******************************************************************************/
142
141
 
143
142
  /** the tcp port that the Node-RED web server is listening on */
144
143
  uiPort: process.env.PORT || 1880,
@@ -178,7 +177,6 @@ module.exports = {
178
177
  // next();
179
178
  // },
180
179
 
181
-
182
180
  /** Some nodes, such as HTTP In, can be used to listen for incoming http requests.
183
181
  * By default, these are served relative to '/'. The following property
184
182
  * can be used to specify a different root path. If set to false, this is
@@ -244,16 +242,16 @@ module.exports = {
244
242
  */
245
243
  //httpStaticRoot: '/static/',
246
244
 
247
- /*******************************************************************************
248
- * Runtime Settings
249
- * - lang
250
- * - runtimeState
251
- * - diagnostics
252
- * - logging
253
- * - contextStorage
254
- * - exportGlobalContextKeys
255
- * - externalModules
256
- ******************************************************************************/
245
+ /*******************************************************************************
246
+ * Runtime Settings
247
+ * - lang
248
+ * - runtimeState
249
+ * - diagnostics
250
+ * - logging
251
+ * - contextStorage
252
+ * - exportGlobalContextKeys
253
+ * - externalModules
254
+ ******************************************************************************/
257
255
 
258
256
  /** Uncomment the following to run node-red in your preferred language.
259
257
  * Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko
@@ -266,7 +264,7 @@ module.exports = {
266
264
  * be available at http://localhost:1880/diagnostics
267
265
  * - ui: When `ui` is `true` (or unset), the action `show-system-info` will
268
266
  * be available to logged in users of node-red editor
269
- */
267
+ */
270
268
  diagnostics: {
271
269
  /** enable or disable diagnostics endpoint. Must be set to `false` to disable */
272
270
  enabled: true,
@@ -299,12 +297,12 @@ module.exports = {
299
297
  * trace - record very detailed logging + debug + info + warn + error + fatal errors
300
298
  * off - turn off all logging (doesn't affect metrics or audit)
301
299
  */
302
- level: "info",
300
+ level: 'info',
303
301
  /** Whether or not to include metric events in the log output */
304
302
  metrics: false,
305
303
  /** Whether or not to include audit events in the log output */
306
- audit: false
307
- }
304
+ audit: false,
305
+ },
308
306
  },
309
307
 
310
308
  /** Context Storage
@@ -355,12 +353,11 @@ module.exports = {
355
353
  // }
356
354
  },
357
355
 
358
-
359
- /*******************************************************************************
360
- * Editor Settings
361
- * - disableEditor
362
- * - editorTheme
363
- ******************************************************************************/
356
+ /*******************************************************************************
357
+ * Editor Settings
358
+ * - disableEditor
359
+ * - editorTheme
360
+ ******************************************************************************/
364
361
 
365
362
  /** The following property can be used to disable the editor. The admin API
366
363
  * is not affected by this option. To disable both the editor and the admin
@@ -385,9 +382,8 @@ module.exports = {
385
382
  //tours: false,
386
383
 
387
384
  header: {
388
- title: "Node-RED powered by ProcessCube&copy;",
389
- url: "https://processcube.io" // optional url to make the header text/image a link to this url
390
-
385
+ title: 'Node-RED powered by ProcessCube &copy;',
386
+ url: 'https://processcube.io', // optional url to make the header text/image a link to this url
391
387
  },
392
388
  palette: {
393
389
  /** The following property can be used to order the categories in the editor
@@ -396,12 +392,7 @@ module.exports = {
396
392
  * If not set, the following default order is used:
397
393
  */
398
394
  //categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'],
399
- categories: [
400
- "ProcessCube",
401
- "ProcessCube Events",
402
- "ProcessCube UI",
403
- "dashboard 2"
404
- ]
395
+ categories: ['ProcessCube', 'ProcessCube Events', 'ProcessCube UI', 'dashboard 2'],
405
396
  },
406
397
 
407
398
  projects: {
@@ -414,15 +405,15 @@ module.exports = {
414
405
  * This can be overridden per-user from the 'Git config'
415
406
  * section of 'User Settings' within the editor
416
407
  */
417
- mode: "manual"
418
- }
408
+ mode: 'manual',
409
+ },
419
410
  },
420
411
 
421
412
  codeEditor: {
422
413
  /** Select the text editor component used by the editor.
423
414
  * As of Node-RED V3, this defaults to "monaco", but can be set to "ace" if desired
424
415
  */
425
- lib: "monaco",
416
+ lib: 'monaco',
426
417
  options: {
427
418
  /** The follow options only apply if the editor is set to "monaco"
428
419
  *
@@ -437,40 +428,39 @@ module.exports = {
437
428
  //fontSize: 14,
438
429
  //fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace",
439
430
  //fontLigatures: true,
440
- }
431
+ },
441
432
  },
442
433
 
443
434
  markdownEditor: {
444
435
  mermaid: {
445
436
  /** enable or disable mermaid diagram in markdown document
446
437
  */
447
- enabled: true
448
- }
438
+ enabled: true,
439
+ },
449
440
  },
450
-
451
441
  },
452
442
 
453
- /*******************************************************************************
454
- * Node Settings
455
- * - fileWorkingDirectory
456
- * - functionGlobalContext
457
- * - functionExternalModules
458
- * - functionTimeout
459
- * - nodeMessageBufferMaxLength
460
- * - ui (for use with Node-RED Dashboard)
461
- * - debugUseColors
462
- * - debugMaxLength
463
- * - execMaxBufferSize
464
- * - httpRequestTimeout
465
- * - mqttReconnectTime
466
- * - serialReconnectTime
467
- * - socketReconnectTime
468
- * - socketTimeout
469
- * - tcpMsgQueueSize
470
- * - inboundWebSocketTimeout
471
- * - tlsConfigDisableLocalFiles
472
- * - webSocketNodeVerifyClient
473
- ******************************************************************************/
443
+ /*******************************************************************************
444
+ * Node Settings
445
+ * - fileWorkingDirectory
446
+ * - functionGlobalContext
447
+ * - functionExternalModules
448
+ * - functionTimeout
449
+ * - nodeMessageBufferMaxLength
450
+ * - ui (for use with Node-RED Dashboard)
451
+ * - debugUseColors
452
+ * - debugMaxLength
453
+ * - execMaxBufferSize
454
+ * - httpRequestTimeout
455
+ * - mqttReconnectTime
456
+ * - serialReconnectTime
457
+ * - socketReconnectTime
458
+ * - socketTimeout
459
+ * - tcpMsgQueueSize
460
+ * - inboundWebSocketTimeout
461
+ * - tlsConfigDisableLocalFiles
462
+ * - webSocketNodeVerifyClient
463
+ ******************************************************************************/
474
464
 
475
465
  /** The working directory to handle relative file paths from within the File nodes
476
466
  * defaults to the working directory of the Node-RED process.
@@ -568,4 +558,4 @@ module.exports = {
568
558
  // * - reason: if result is false, the HTTP reason string to return
569
559
  // */
570
560
  //},
571
- }
561
+ };
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "0.14.0-feature-7cec87-lyytfjz9",
3
+ "version": "0.14.0-fix-error-in-process-instance-query-9aeac9-lyzi0gix",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
+ "scripts": {
7
+ "lint": "prettier --write --config ./.prettierrc.json \"**/*.{html,js}\""
8
+ },
6
9
  "authors": [
7
10
  {
8
11
  "name": "Martin Moellenbeck",
@@ -48,7 +51,7 @@
48
51
  }
49
52
  },
50
53
  "dependencies": {
51
- "@5minds/processcube_engine_client": "5.0.0-hotfix-d834af-lyymqumd",
54
+ "@5minds/processcube_engine_client": "^5.0.0",
52
55
  "jwt-decode": "^4.0.0",
53
56
  "openid-client": "^5.5.0"
54
57
  },
@@ -58,5 +61,8 @@
58
61
  "workflow",
59
62
  "bpmn",
60
63
  "low-code"
61
- ]
64
+ ],
65
+ "devDependencies": {
66
+ "prettier": "^3.3.3"
67
+ }
62
68
  }
@@ -3,54 +3,50 @@
3
3
  category: 'ProcessCube',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- processmodel: {value: "", required: false},
9
- startevent: {value: "", required: false}
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ processmodel: { value: '', required: false },
9
+ startevent: { value: '', required: false },
10
10
  },
11
11
  inputs: 1,
12
12
  outputs: 1,
13
- icon: "font-awesome/fa-sign-in",
14
- label: function() {
15
- return this.name||"process-start";
16
- }
13
+ icon: 'font-awesome/fa-sign-in',
14
+ label: function () {
15
+ return this.name || 'process-start';
16
+ },
17
17
  });
18
18
  </script>
19
19
 
20
20
  <script type="text/html" data-template-name="process-start">
21
21
  <div class="form-row">
22
22
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
23
- <input type="text" id="node-input-name" placeholder="Name">
23
+ <input type="text" id="node-input-name" placeholder="Name" />
24
24
  </div>
25
25
  <div class="form-row">
26
26
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
27
- <input type="text" id="node-input-engine" placeholder="Engine-URL">
27
+ <input type="text" id="node-input-engine" placeholder="Engine-URL" />
28
28
  </div>
29
29
  <div class="form-row">
30
30
  <label for="node-input-processmodel"><i class="fa fa-tag"></i> Processmodel</label>
31
- <input type="text" id="node-input-processmodel" placeholder="ID of Processmodel">
31
+ <input type="text" id="node-input-processmodel" placeholder="ID of Processmodel" />
32
32
  </div>
33
33
  <div class="form-row">
34
34
  <label for="node-input-startevent"><i class="fa fa-tag"></i> Startevent</label>
35
- <input type="text" id="node-input-startevent" placeholder="ID of Startevent">
35
+ <input type="text" id="node-input-startevent" placeholder="ID of Startevent" />
36
36
  </div>
37
37
  </script>
38
38
 
39
39
  <script type="text/html" data-help-name="process-start">
40
40
  <h2>Start a Processmodel in the ProcessCube</h2>
41
+ <p>If the <code>msg.payload</code> is set, it will be used as the input for the process.</p>
41
42
  <p>
42
- If the <code>msg.payload</code> is set, it will be used as the input for the process.
43
- </p>
44
- <p>
45
- If a <code>msg.processModelId</code> is set, it will be used as the process model and
46
- override the configured <b>Processmodel</b>.
43
+ If a <code>msg.processModelId</code> is set, it will be used as the process model and override the configured
44
+ <b>Processmodel</b>.
47
45
  </p>
48
46
  <p>
49
- If a <code>msg.startEventId</code> is set, it will be used as the start event and
50
- override the configured <b>Startevent</b>.
47
+ If a <code>msg.startEventId</code> is set, it will be used as the start event and override the configured
48
+ <b>Startevent</b>.
51
49
  </p>
52
50
  <h3>More documentation</h3>
53
- <p>
54
- The Dokumenation can be found on <a href="https://processcube.io">ProcessCube Developer Network</a>.
55
- </p>
56
- </script>
51
+ <p>The Dokumenation can be found on <a href="https://processcube.io">ProcessCube Developer Network</a>.</p>
52
+ </script>
package/process-start.js CHANGED
@@ -1,9 +1,9 @@
1
1
  const process = require('process');
2
2
  const engine_client = require('@5minds/processcube_engine_client');
3
3
 
4
- module.exports = function(RED) {
4
+ module.exports = function (RED) {
5
5
  function ProcessStart(config) {
6
- RED.nodes.createNode(this,config);
6
+ RED.nodes.createNode(this, config);
7
7
  var node = this;
8
8
  var flowContext = node.context().flow;
9
9
  var nodeContext = node.context();
@@ -17,27 +17,27 @@ module.exports = function(RED) {
17
17
  if (!client) {
18
18
  nodeContext.set('client', new engine_client.EngineClient(engineUrl));
19
19
  client = nodeContext.get('client');
20
- }
21
-
22
- node.on('input', function(msg) {
20
+ }
23
21
 
22
+ node.on('input', function (msg) {
24
23
  const startParameters = {
25
24
  processModelId: msg.processModelId || config.processmodel,
26
25
  startEventId: msg.startEventId || config.startevent,
27
- initialToken: msg.payload
26
+ initialToken: msg.payload,
28
27
  };
29
28
 
30
- client.processDefinitions.startProcessInstance(startParameters, node.engine.identity).then((result) => {
31
-
32
- msg.payload = result;
33
-
34
- node.send(msg);
35
- node.status({fill: "blue", shape: "dot", text: `started ${result.processInstanceId}`});
36
-
37
- }).catch((error) => {
38
- node.error(error);
39
- });
29
+ client.processDefinitions
30
+ .startProcessInstance(startParameters, node.engine.identity)
31
+ .then((result) => {
32
+ msg.payload = result;
33
+
34
+ node.send(msg);
35
+ node.status({ fill: 'blue', shape: 'dot', text: `started ${result.processInstanceId}` });
36
+ })
37
+ .catch((error) => {
38
+ node.error(error);
39
+ });
40
40
  });
41
41
  }
42
- RED.nodes.registerType("process-start", ProcessStart);
43
- }
42
+ RED.nodes.registerType('process-start', ProcessStart);
43
+ };
@@ -1,30 +1,30 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('processcube-engine-config',{
2
+ RED.nodes.registerType('processcube-engine-config', {
3
3
  category: 'config',
4
4
  defaults: {
5
- url: {value:"http://engine:8000",required:true}
5
+ url: { value: 'http://engine:8000', required: true },
6
6
  },
7
- label: function() {
7
+ label: function () {
8
8
  return this.url;
9
9
  },
10
10
  credentials: {
11
- clientId: { type: "text" },
12
- clientSecret: { type: "password" }
13
- }
11
+ clientId: { type: 'text' },
12
+ clientSecret: { type: 'password' },
13
+ },
14
14
  });
15
15
  </script>
16
16
 
17
17
  <script type="text/html" data-template-name="processcube-engine-config">
18
18
  <div class="form-row">
19
19
  <label for="node-config-input-url"><i class="fa fa-bookmark"></i> Url</label>
20
- <input type="text" id="node-config-input-url">
20
+ <input type="text" id="node-config-input-url" />
21
21
  </div>
22
22
  <div class="form-row">
23
23
  <label for="node-config-input-clientId"><i class="fa fa-bookmark"></i> Client id</label>
24
- <input type="text" id="node-config-input-clientId">
24
+ <input type="text" id="node-config-input-clientId" />
25
25
  </div>
26
26
  <div class="form-row">
27
27
  <label for="node-config-input-clientSecret"><i class="fa fa-bookmark"></i> Client secret</label>
28
- <input type="password" id="node-config-input-clientSecret">
28
+ <input type="password" id="node-config-input-clientSecret" />
29
29
  </div>
30
- </script>
30
+ </script>
@@ -4,7 +4,7 @@ const oidc = require('openid-client');
4
4
 
5
5
  const DELAY_FACTOR = 0.85;
6
6
 
7
- module.exports = function(RED) {
7
+ module.exports = function (RED) {
8
8
  function ProcessCubeEngineNode(n) {
9
9
  RED.nodes.createNode(this, n);
10
10
  const node = this;
@@ -14,8 +14,7 @@ module.exports = function(RED) {
14
14
  this.registerOnIdentityChanged = function (callback) {
15
15
  identityChangedCallbacks.push(callback);
16
16
  };
17
-
18
- this.setIdentity = (identity) => {
17
+ this.setIdentity = (identity) => {
19
18
  this.identity = identity;
20
19
 
21
20
  for (const callback of identityChangedCallbacks) {
@@ -23,41 +22,35 @@ module.exports = function(RED) {
23
22
  }
24
23
  };
25
24
 
26
- var nodeContext = node.context();
27
-
28
- this.getEngineClient = () => {
29
- const engineUrl = this.url || process.env.ENGINE_URL || 'http://engine:8000';
30
- let client = nodeContext.get('client');
31
-
32
- if (!client) {
33
- nodeContext.set('client', new engine_client.EngineClient(engineUrl));
34
- client = nodeContext.get('client');
35
- }
36
-
37
- return client;
38
- };
39
-
40
25
  if (this.credentials.clientId && this.credentials.clientSecret) {
41
26
  const engineClient = new engine_client.EngineClient(this.url);
42
27
 
43
- engineClient.applicationInfo.getAuthorityAddress().then(authorityUrl => {
44
- startRefreshingIdentityCycle(this.credentials.clientId, this.credentials.clientSecret, authorityUrl, this).catch(reason => {
28
+ engineClient.applicationInfo
29
+ .getAuthorityAddress()
30
+ .then((authorityUrl) => {
31
+ startRefreshingIdentityCycle(
32
+ this.credentials.clientId,
33
+ this.credentials.clientSecret,
34
+ authorityUrl,
35
+ this,
36
+ ).catch((reason) => {
37
+ console.error(reason);
38
+ node.error(reason);
39
+ });
40
+ })
41
+ .catch((reason) => {
45
42
  console.error(reason);
46
43
  node.error(reason);
47
44
  });
48
- }).catch((reason) => {
49
- console.error(reason);
50
- node.error(reason);
51
- });
52
45
  }
53
46
  }
54
- RED.nodes.registerType("processcube-engine-config", ProcessCubeEngineNode, {
47
+ RED.nodes.registerType('processcube-engine-config', ProcessCubeEngineNode, {
55
48
  credentials: {
56
- clientId: { type: "text" },
57
- clientSecret: { type: "password" }
58
- }
49
+ clientId: { type: 'text' },
50
+ clientSecret: { type: 'password' },
51
+ },
59
52
  });
60
- }
53
+ };
61
54
 
62
55
  async function getFreshTokenSet(clientId, clientSecret, authorityUrl) {
63
56
  const issuer = await oidc.Issuer.discover(authorityUrl);
@@ -76,7 +69,6 @@ async function getFreshTokenSet(clientId, clientSecret, authorityUrl) {
76
69
  }
77
70
 
78
71
  function getIdentityForExternalTaskWorkers(tokenSet) {
79
-
80
72
  const accessToken = tokenSet.access_token;
81
73
  const decodedToken = jwt.jwtDecode(accessToken);
82
74
 
@@ -140,4 +132,4 @@ async function startRefreshingIdentityCycle(clientId, clientSecret, authorityUrl
140
132
  };
141
133
 
142
134
  await refresh();
143
- }
135
+ }