@5minds/node-red-contrib-processcube 0.14.0-develop-7fe136-lygsbbpi → 0.14.0-error-handling-in-process-instance-query-and-add-prettier-8b2f33-lz08cr3v
Sign up to get free protection for your applications and to get access to all the features.
- package/.prettierrc.json +6 -0
- package/Dockerfile +1 -1
- package/docker-compose.yml +12 -0
- package/examples/External-Task-Sample.json +252 -0
- package/externaltask-error.html +26 -12
- package/externaltask-error.js +19 -22
- package/externaltask-input.html +31 -14
- package/externaltask-input.js +114 -57
- package/externaltask-output.html +20 -10
- package/externaltask-output.js +11 -12
- package/message-event-trigger.html +14 -14
- package/message-event-trigger.js +25 -33
- package/nodered/node-red-contrib-processcube-flows.json +216 -132
- package/nodered/package.json +1 -0
- package/nodered/settings.js +82 -92
- package/package.json +5 -2
- package/process-start.html +19 -23
- package/process-start.js +22 -27
- package/processcube-engine-config.html +10 -10
- package/processcube-engine-config.js +39 -17
- package/processdefinition-query.html +29 -23
- package/processdefinition-query.js +13 -25
- package/processes/External-Task-Sample.bpmn +94 -0
- package/processinstance-query.html +19 -20
- package/processinstance-query.js +17 -21
- package/signal-event-trigger.html +14 -14
- package/signal-event-trigger.js +25 -33
- package/usertask-finished-listener.html +17 -12
- package/usertask-finished-listener.js +34 -24
- package/usertask-input.html +40 -27
- package/usertask-input.js +34 -29
- package/usertask-new-listener.html +17 -12
- package/usertask-new-listener.js +35 -26
- package/usertask-output.html +23 -24
- package/usertask-output.js +13 -21
- package/processes/CheckError.bpmn +0 -78
- package/processes/NodeRedExternalTask.bpmn +0 -77
- package/processes/SampleUserTask.bpmn +0 -95
package/nodered/settings.js
CHANGED
@@ -21,15 +21,14 @@
|
|
21
21
|
**/
|
22
22
|
|
23
23
|
module.exports = {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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:
|
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
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
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
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
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:
|
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
|
-
|
361
|
-
|
362
|
-
|
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:
|
389
|
-
url:
|
390
|
-
|
385
|
+
title: 'Node-RED powered by ProcessCube©',
|
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:
|
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:
|
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
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
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-
|
3
|
+
"version": "0.14.0-error-handling-in-process-instance-query-and-add-prettier-8b2f33-lz08cr3v",
|
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.
|
54
|
+
"@5minds/processcube_engine_client": "^5.0.1",
|
52
55
|
"jwt-decode": "^4.0.0",
|
53
56
|
"openid-client": "^5.5.0"
|
54
57
|
},
|
package/process-start.html
CHANGED
@@ -3,54 +3,50 @@
|
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
processmodel: {value:
|
9
|
-
startevent: {value:
|
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:
|
14
|
-
label: function() {
|
15
|
-
return this.name||
|
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
|
43
|
-
|
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
|
-
|
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
|
-
|
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,43 +1,38 @@
|
|
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
|
-
var flowContext = node.context().flow;
|
9
|
-
var nodeContext = node.context();
|
10
8
|
|
11
9
|
this.engine = this.server = RED.nodes.getNode(config.engine);
|
12
10
|
|
13
|
-
const
|
14
|
-
|
15
|
-
var client = nodeContext.get('client');
|
16
|
-
|
17
|
-
if (!client) {
|
18
|
-
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
19
|
-
client = nodeContext.get('client');
|
20
|
-
}
|
21
|
-
|
22
|
-
node.on('input', function(msg) {
|
11
|
+
const client = this.engine.getEngineClient();
|
23
12
|
|
13
|
+
node.on('input', function (msg) {
|
24
14
|
const startParameters = {
|
25
15
|
processModelId: msg.processModelId || config.processmodel,
|
26
16
|
startEventId: msg.startEventId || config.startevent,
|
27
|
-
initialToken: msg.payload
|
17
|
+
initialToken: msg.payload,
|
28
18
|
};
|
29
19
|
|
30
|
-
client.processDefinitions
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
20
|
+
client.processDefinitions
|
21
|
+
.startProcessInstance(startParameters, node.engine.identity)
|
22
|
+
.then((result) => {
|
23
|
+
msg.payload = result;
|
24
|
+
|
25
|
+
node.send(msg);
|
26
|
+
node.status({
|
27
|
+
fill: 'blue',
|
28
|
+
shape: 'dot',
|
29
|
+
text: `started ${result.processInstanceId}`,
|
30
|
+
});
|
31
|
+
})
|
32
|
+
.catch((error) => {
|
33
|
+
node.error(error);
|
34
|
+
});
|
40
35
|
});
|
41
36
|
}
|
42
|
-
RED.nodes.registerType(
|
43
|
-
}
|
37
|
+
RED.nodes.registerType('process-start', ProcessStart);
|
38
|
+
};
|
@@ -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:
|
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:
|
12
|
-
clientSecret: { type:
|
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;
|
@@ -13,36 +13,59 @@ module.exports = function(RED) {
|
|
13
13
|
this.identity = null;
|
14
14
|
this.registerOnIdentityChanged = function (callback) {
|
15
15
|
identityChangedCallbacks.push(callback);
|
16
|
-
}
|
17
|
-
|
16
|
+
};
|
17
|
+
|
18
|
+
this.setIdentity = (identity) => {
|
18
19
|
this.identity = identity;
|
19
20
|
|
20
21
|
for (const callback of identityChangedCallbacks) {
|
21
22
|
callback(identity);
|
22
23
|
}
|
23
|
-
}
|
24
|
+
};
|
25
|
+
|
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
|
+
};
|
24
39
|
|
25
40
|
if (this.credentials.clientId && this.credentials.clientSecret) {
|
26
41
|
const engineClient = new engine_client.EngineClient(this.url);
|
27
42
|
|
28
|
-
engineClient.applicationInfo
|
29
|
-
|
43
|
+
engineClient.applicationInfo
|
44
|
+
.getAuthorityAddress()
|
45
|
+
.then((authorityUrl) => {
|
46
|
+
startRefreshingIdentityCycle(
|
47
|
+
this.credentials.clientId,
|
48
|
+
this.credentials.clientSecret,
|
49
|
+
authorityUrl,
|
50
|
+
this,
|
51
|
+
).catch((reason) => {
|
52
|
+
console.error(reason);
|
53
|
+
node.error(reason);
|
54
|
+
});
|
55
|
+
})
|
56
|
+
.catch((reason) => {
|
30
57
|
console.error(reason);
|
31
58
|
node.error(reason);
|
32
59
|
});
|
33
|
-
}).catch((reason) => {
|
34
|
-
console.error(reason);
|
35
|
-
node.error(reason);
|
36
|
-
});
|
37
60
|
}
|
38
61
|
}
|
39
|
-
RED.nodes.registerType(
|
62
|
+
RED.nodes.registerType('processcube-engine-config', ProcessCubeEngineNode, {
|
40
63
|
credentials: {
|
41
|
-
clientId: { type:
|
42
|
-
clientSecret: { type:
|
43
|
-
}
|
64
|
+
clientId: { type: 'text' },
|
65
|
+
clientSecret: { type: 'password' },
|
66
|
+
},
|
44
67
|
});
|
45
|
-
}
|
68
|
+
};
|
46
69
|
|
47
70
|
async function getFreshTokenSet(clientId, clientSecret, authorityUrl) {
|
48
71
|
const issuer = await oidc.Issuer.discover(authorityUrl);
|
@@ -61,7 +84,6 @@ async function getFreshTokenSet(clientId, clientSecret, authorityUrl) {
|
|
61
84
|
}
|
62
85
|
|
63
86
|
function getIdentityForExternalTaskWorkers(tokenSet) {
|
64
|
-
|
65
87
|
const accessToken = tokenSet.access_token;
|
66
88
|
const decodedToken = jwt.jwtDecode(accessToken);
|
67
89
|
|
@@ -125,4 +147,4 @@ async function startRefreshingIdentityCycle(clientId, clientSecret, authorityUrl
|
|
125
147
|
};
|
126
148
|
|
127
149
|
await refresh();
|
128
|
-
}
|
150
|
+
}
|