@5minds/node-red-contrib-processcube 0.14.0 → 0.15.0-develop-2d3c96-lz098cox

Sign up to get free protection for your applications and to get access to all the features.
@@ -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",
3
+ "version": "0.15.0-develop-2d3c96-lz098cox",
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",
@@ -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,5 +1,5 @@
1
- const process = require("process");
2
- const engine_client = require("@5minds/processcube_engine_client");
1
+ const process = require('process');
2
+ const engine_client = require('@5minds/processcube_engine_client');
3
3
 
4
4
  module.exports = function (RED) {
5
5
  function ProcessStart(config) {
@@ -10,7 +10,7 @@ module.exports = function (RED) {
10
10
 
11
11
  const client = this.engine.getEngineClient();
12
12
 
13
- node.on("input", function (msg) {
13
+ node.on('input', function (msg) {
14
14
  const startParameters = {
15
15
  processModelId: msg.processModelId || config.processmodel,
16
16
  startEventId: msg.startEventId || config.startevent,
@@ -24,8 +24,8 @@ module.exports = function (RED) {
24
24
 
25
25
  node.send(msg);
26
26
  node.status({
27
- fill: "blue",
28
- shape: "dot",
27
+ fill: 'blue',
28
+ shape: 'dot',
29
29
  text: `started ${result.processInstanceId}`,
30
30
  });
31
31
  })
@@ -34,5 +34,5 @@ module.exports = function (RED) {
34
34
  });
35
35
  });
36
36
  }
37
- RED.nodes.registerType("process-start", ProcessStart);
37
+ RED.nodes.registerType('process-start', ProcessStart);
38
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:"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;
@@ -15,7 +15,7 @@ module.exports = function(RED) {
15
15
  identityChangedCallbacks.push(callback);
16
16
  };
17
17
 
18
- this.setIdentity = (identity) => {
18
+ this.setIdentity = (identity) => {
19
19
  this.identity = identity;
20
20
 
21
21
  for (const callback of identityChangedCallbacks) {
@@ -32,7 +32,7 @@ module.exports = function(RED) {
32
32
  if (!client) {
33
33
  nodeContext.set('client', new engine_client.EngineClient(engineUrl));
34
34
  client = nodeContext.get('client');
35
- }
35
+ }
36
36
 
37
37
  return client;
38
38
  };
@@ -40,24 +40,32 @@ module.exports = function(RED) {
40
40
  if (this.credentials.clientId && this.credentials.clientSecret) {
41
41
  const engineClient = new engine_client.EngineClient(this.url);
42
42
 
43
- engineClient.applicationInfo.getAuthorityAddress().then(authorityUrl => {
44
- startRefreshingIdentityCycle(this.credentials.clientId, this.credentials.clientSecret, authorityUrl, this).catch(reason => {
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) => {
45
57
  console.error(reason);
46
58
  node.error(reason);
47
59
  });
48
- }).catch((reason) => {
49
- console.error(reason);
50
- node.error(reason);
51
- });
52
60
  }
53
61
  }
54
- RED.nodes.registerType("processcube-engine-config", ProcessCubeEngineNode, {
62
+ RED.nodes.registerType('processcube-engine-config', ProcessCubeEngineNode, {
55
63
  credentials: {
56
- clientId: { type: "text" },
57
- clientSecret: { type: "password" }
58
- }
64
+ clientId: { type: 'text' },
65
+ clientSecret: { type: 'password' },
66
+ },
59
67
  });
60
- }
68
+ };
61
69
 
62
70
  async function getFreshTokenSet(clientId, clientSecret, authorityUrl) {
63
71
  const issuer = await oidc.Issuer.discover(authorityUrl);
@@ -76,7 +84,6 @@ async function getFreshTokenSet(clientId, clientSecret, authorityUrl) {
76
84
  }
77
85
 
78
86
  function getIdentityForExternalTaskWorkers(tokenSet) {
79
-
80
87
  const accessToken = tokenSet.access_token;
81
88
  const decodedToken = jwt.jwtDecode(accessToken);
82
89
 
@@ -140,4 +147,4 @@ async function startRefreshingIdentityCycle(clientId, clientSecret, authorityUrl
140
147
  };
141
148
 
142
149
  await refresh();
143
- }
150
+ }
@@ -3,52 +3,58 @@
3
3
  category: 'ProcessCube',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- query: {value: "payload"},
9
- query_type: {value: "msg"},
10
- models_only: {value: false},
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ query: { value: 'payload' },
9
+ query_type: { value: 'msg' },
10
+ models_only: { value: false },
11
11
  },
12
12
  inputs: 1,
13
13
  outputs: 1,
14
- icon: "font-awesome/fa-envelope-open",
15
- label: function() {
16
- return this.name || "processdefinition-query";
14
+ icon: 'font-awesome/fa-envelope-open',
15
+ label: function () {
16
+ return this.name || 'processdefinition-query';
17
17
  },
18
- oneditprepare: function() {
19
- $("#node-input-query").typedInput({
18
+ oneditprepare: function () {
19
+ $('#node-input-query').typedInput({
20
20
  default: 'msg',
21
- types: ['msg', 'json']
21
+ types: ['msg', 'json'],
22
22
  });
23
23
 
24
- $("#node-input-query").typedInput('value', this.query);
25
- $("#node-input-query").typedInput('type', this.query_type);
24
+ $('#node-input-query').typedInput('value', this.query);
25
+ $('#node-input-query').typedInput('type', this.query_type);
26
+ },
27
+ oneditsave: function () {
28
+ (this.query = $('#node-input-query').typedInput('value')),
29
+ (this.query_type = $('#node-input-query').typedInput('type'));
26
30
  },
27
- oneditsave: function() {
28
- this.query = $("#node-input-query").typedInput('value'),
29
- this.query_type = $("#node-input-query").typedInput('type')
30
-
31
- }
32
31
  });
33
32
  </script>
34
33
 
35
34
  <script type="text/html" data-template-name="processdefinition-query">
36
35
  <div class="form-row">
37
36
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
38
- <input type="text" id="node-input-name" placeholder="Name">
37
+ <input type="text" id="node-input-name" placeholder="Name" />
39
38
  </div>
40
39
  <div class="form-row">
41
40
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
42
- <input type="text" id="node-input-engine" placeholder="http://engine:8000">
41
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
43
42
  </div>
44
43
  <div class="form-row">
45
44
  <label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
46
- <input type="text" id="node-input-query">
45
+ <input type="text" id="node-input-query" />
47
46
  </div>
48
47
  <div class="form-row" style="display:flex; margin-bottom: 3px;">
49
- <label for="node-input-models_only" style="vertical-align:top"><i class="fa fa-list-alt"></i> Models Only</label>
48
+ <label for="node-input-models_only" style="vertical-align:top"
49
+ ><i class="fa fa-list-alt"></i> Models Only</label
50
+ >
50
51
  <div>
51
- <input type="checkbox" checked id="node-input-models_only" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
52
+ <input
53
+ type="checkbox"
54
+ checked
55
+ id="node-input-models_only"
56
+ style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
57
+ />
52
58
  <label style="width:auto" for="node-input-models_only">Only send models as result.</label>
53
59
  </div>
54
60
  </div>