node-red 2.2.2 → 3.0.0-beta.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,80 @@
1
+ #### 3.0.0-beta.1: Beta Release
2
+
3
+ **Migration from 2.x**
4
+
5
+ - Node-RED now requires Node.js 14.x or later.
6
+ - New installs of Node-RED will default to the monaco editor.
7
+
8
+
9
+ Editor
10
+
11
+ - Add Junctions (#3462) @knolleary
12
+ - Allow node name to be auto-generated when added (#3478, #3538) @knolleary
13
+ - Set monaco as default code editor as of v3.x (#3543) @Steve-Mcl
14
+ - Update Monaco to V0.33.0 (#3522) @Steve-Mcl
15
+ - Auto-complete Improvements (#3521) @Steve-Mcl
16
+ - Add a tooltip to debug sidebar messages to reveal full path to node (#3503) @knolleary
17
+ - Fix down arrow triggering menu in search box (#3507) @Steve-Mcl
18
+ - Add Japanese translations for v3.0 (#3512) @kazuhitoyokoi
19
+ - Add feature: Continuous search tools (search previous, search next) (#3405) @Steve-Mcl
20
+ - Add feature: split-wire-to-links (#3399, #3476) @Steve-Mcl
21
+ - Add copy button to node properties tables (#3390) @knolleary
22
+ - Add info-tab search options dropdown to the regular search (#3395) @Steve-Mcl
23
+ - New Feature: Add ability to find modified nodes/flows. (#3392) @Steve-Mcl
24
+ - Code editor ux improvements around remembering state of each code editor in a flow (#3553) @Steve-Mcl
25
+ - Make it easier to apply themes on SVG icons (#3515) @bonanitech
26
+ - Add support of property validation message (#3438) @HiroyasuNishiyama
27
+ - Ensure node validation tooltip is closed when field becomes valid (#3570) @knolleary
28
+ - Add "search for" buttons to notifications (#3567) @Steve-Mcl
29
+ - Don't let themes change node config colors (#3564) @bonanitech
30
+ - Fix gap between typedInput containers borders (#3560) @bonanitech
31
+ - Fix recording removed links in edit history (#3547) @knolleary
32
+ - Remove unused SASS vars (#3536) @bonanitech
33
+ - Add custom style for jQuery widgets borders (#3537) @bonanitech
34
+ - fix out of scope reference of hasUnusedConfig variable (#3535) @HiroyasuNishiyama
35
+ - correct "non string" check parenthesis (#3524) @Steve-Mcl
36
+ - Ensure i18n of scoped package name (#3516) @Steve-Mcl
37
+ - Prevent shortcut deploy when deploy button shaded (#3517) @Steve-Mcl
38
+ - Fix: Sidebar "Configuration" filter button tooltip (#3500) @ralphwetzel
39
+ - Add the ability to customize diff colors even more (#3499) @bonanitech
40
+ - Do JSON comparison of old value/new value in editor (#3481) @Steve-Mcl
41
+ - Fix nodes losing their wires when in an iframe (#3484) @zettca
42
+ - Improve scroll into view (#3468) @Steve-Mcl
43
+ - Do not show 1st tab if hidden when loading (#3464) @Steve-Mcl
44
+
45
+ Runtime
46
+
47
+ - Fix importing external module from node-red module (#3541) @knolleary
48
+ - Add support for multiple static paths with optional static root (#3542) @Steve-Mcl
49
+ - Store external token when authenticating if provided (#3460) @ArFe
50
+ - Support OAuth/OpenID logout (#3388) @mw75
51
+ - Allow adminAuth to auto-login users when using passport strategy (#3519) @knolleary
52
+ - Add runtime diagnostics admin endpoint (#3511) @Steve-Mcl
53
+ - Don't start if user has no home directory (#3540) @hardillb
54
+ - Error on invalid encrypted credentials (#3498) @sammachin
55
+
56
+ Nodes
57
+
58
+ - Debug: Add message count option to Debug status (#3544 #3551) @rafaelmuynarsk @knolleary
59
+ - File: Change basic Filename field to a typedInput (#3533) @Steve-Mcl
60
+ - HTTP Request: Add UI for Http Request node headers (#3488) @Steve-Mcl
61
+ - Inject: let inject optionally fire at start in only at time mode. (#3385) @dceejay
62
+ - Link Call: Dynamic link call (#3463) @Steve-Mcl
63
+ - Link Call: Display link targets of nodes in a regular flow, for Link Call nodes inside a subflow (#3528) @Steve-Mcl
64
+ - MQTT: MQTT payload auto parsing improvements (#3530) @Steve-Mcl
65
+ - MQTT: Add client and Runtime MQTT topic validation (#3563) @Steve-Mcl [dev]
66
+ - MQTT: save and restore v5 config user props (#3562) @Steve-Mcl
67
+ - MQTT: Fix incorrect MQTT status (#3552) @Steve-Mcl
68
+ - MQTT: fix reference error of msg.status in debug node (#3526) @HiroyasuNishiyama
69
+ - MQTT: Add unit tests for MQTT nodes (#3497) @Steve-Mcl
70
+ - MQTT: fix typo of will properties (#3502) @Steve-Mcl
71
+ - MQTT: ensure mqtt v5 props can be set false (#3472) @Steve-Mcl
72
+ - Switch: add check for NaN in is of type number to be false (#3409) @dceejay
73
+ - TCP: TCP node better split (#3465) @dceejay
74
+ - Watch: Update Watch node to use node-watch module (#3559 #3569) @knolleary
75
+ - WebSocket: call done after ws disconnects (#3531) @Steve-Mcl
76
+
77
+
1
78
  #### 2.2.2: Maintenance Release
2
79
 
3
80
  Nodes
package/lib/red.js CHANGED
@@ -229,5 +229,12 @@ module.exports = {
229
229
  * @see @node-red/editor-api_auth
230
230
  * @memberof node-red
231
231
  */
232
- auth: api.auth
232
+ auth: api.auth,
233
+
234
+ /**
235
+ * The editor authentication api.
236
+ * @see @node-red/editor-api_auth
237
+ * @memberof node-red
238
+ */
239
+ get diagnostics() { return api.diagnostics }
233
240
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red",
3
- "version": "2.2.2",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "Low-code programming for event-driven applications",
5
5
  "homepage": "http://nodered.org",
6
6
  "license": "Apache-2.0",
@@ -31,22 +31,22 @@
31
31
  "flow"
32
32
  ],
33
33
  "dependencies": {
34
- "@node-red/editor-api": "2.2.2",
35
- "@node-red/runtime": "2.2.2",
36
- "@node-red/util": "2.2.2",
37
- "@node-red/nodes": "2.2.2",
34
+ "@node-red/editor-api": "3.0.0-beta.1",
35
+ "@node-red/runtime": "3.0.0-beta.1",
36
+ "@node-red/util": "3.0.0-beta.1",
37
+ "@node-red/nodes": "3.0.0-beta.1",
38
38
  "basic-auth": "2.0.1",
39
39
  "bcryptjs": "2.4.3",
40
- "express": "4.17.2",
41
- "fs-extra": "10.0.0",
42
- "node-red-admin": "^2.2.3",
40
+ "express": "4.18.1",
41
+ "fs-extra": "10.1.0",
42
+ "node-red-admin": "^3.0.0",
43
43
  "nopt": "5.0.0",
44
- "semver": "7.3.5"
44
+ "semver": "7.3.7"
45
45
  },
46
46
  "optionalDependencies": {
47
47
  "bcrypt": "5.0.1"
48
48
  },
49
49
  "engines": {
50
- "node": ">=12"
50
+ "node": ">=14"
51
51
  }
52
52
  }
package/red.js CHANGED
@@ -112,6 +112,10 @@ if (parsedArgs.settings) {
112
112
  // Consider compatibility for older versions
113
113
  settingsFile = path.join(process.env.HOMEPATH,".node-red","settings.js");
114
114
  } else {
115
+ if (!parsedArgs.userDir && !(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH)) {
116
+ console.log("Could not find user directory. Ensure $HOME is set for the current user, or use --userDir option")
117
+ process.exit(1)
118
+ }
115
119
  var userDir = parsedArgs.userDir || path.join(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,".node-red");
116
120
  var userSettingsFile = path.join(userDir,"settings.js");
117
121
  if (fs.existsSync(userSettingsFile)) {
@@ -298,6 +302,26 @@ httpsPromise.then(function(startupHttps) {
298
302
  settings.httpNodeAuth = settings.httpNodeAuth || settings.httpAuth;
299
303
  }
300
304
 
305
+ if(settings.httpStatic) {
306
+ settings.httpStaticRoot = formatRoot(settings.httpStaticRoot || "/");
307
+ const statics = Array.isArray(settings.httpStatic) ? settings.httpStatic : [settings.httpStatic];
308
+ const sanitised = [];
309
+ for (let si = 0; si < statics.length; si++) {
310
+ let sp = statics[si];
311
+ if(typeof sp === "string") {
312
+ sp = { path: sp, root: "" }
313
+ sanitised.push(sp);
314
+ } else if (typeof sp === "object" && sp.path ) {
315
+ sanitised.push(sp);
316
+ } else {
317
+ continue;
318
+ }
319
+ sp.subRoot = formatRoot(sp.root);
320
+ sp.root = formatRoot(path.posix.join(settings.httpStaticRoot,sp.subRoot));
321
+ }
322
+ settings.httpStatic = sanitised.length ? sanitised : false;
323
+ }
324
+
301
325
  // if we got a port from command line, use it (even if 0)
302
326
  // replicate (settings.uiPort = parsedArgs.port||settings.uiPort||1880;) but allow zero
303
327
  if (parsedArgs.port !== undefined){
@@ -390,12 +414,28 @@ httpsPromise.then(function(startupHttps) {
390
414
  if (settings.httpNodeRoot !== false) {
391
415
  app.use(settings.httpNodeRoot,RED.httpNode);
392
416
  }
417
+ // if (settings.httpStatic) {
418
+ // settings.httpStaticAuth = settings.httpStaticAuth || settings.httpAuth;
419
+ // if (settings.httpStaticAuth) {
420
+ // app.use("/",basicAuthMiddleware(settings.httpStaticAuth.user,settings.httpStaticAuth.pass));
421
+ // }
422
+ // app.use("/",express.static(settings.httpStatic));
423
+ // }
393
424
  if (settings.httpStatic) {
394
- settings.httpStaticAuth = settings.httpStaticAuth || settings.httpAuth;
395
- if (settings.httpStaticAuth) {
396
- app.use("/",basicAuthMiddleware(settings.httpStaticAuth.user,settings.httpStaticAuth.pass));
425
+ let appUseMem = {};
426
+ for (let si = 0; si < settings.httpStatic.length; si++) {
427
+ const sp = settings.httpStatic[si];
428
+ const filePath = sp.path;
429
+ const thisRoot = sp.root || "/";
430
+ if(appUseMem[filePath + "::" + thisRoot]) {
431
+ continue;// this path and root already registered!
432
+ }
433
+ appUseMem[filePath + "::" + thisRoot] = true;
434
+ if (settings.httpStaticAuth) {
435
+ app.use(thisRoot, basicAuthMiddleware(settings.httpStaticAuth.user, settings.httpStaticAuth.pass));
436
+ }
437
+ app.use(thisRoot, express.static(filePath));
397
438
  }
398
- app.use("/",express.static(settings.httpStatic));
399
439
  }
400
440
 
401
441
  function getListenPath() {
package/settings.js CHANGED
@@ -137,6 +137,7 @@ module.exports = {
137
137
  * - httpNodeCors
138
138
  * - httpNodeMiddleware
139
139
  * - httpStatic
140
+ * - httpStaticRoot
140
141
  ******************************************************************************/
141
142
 
142
143
  /** the tcp port that the Node-RED web server is listening on */
@@ -218,12 +219,30 @@ module.exports = {
218
219
  /** When httpAdminRoot is used to move the UI to a different root path, the
219
220
  * following property can be used to identify a directory of static content
220
221
  * that should be served at http://localhost:1880/.
222
+ * When httpStaticRoot is set differently to httpAdminRoot, there is no need
223
+ * to move httpAdminRoot
221
224
  */
222
- //httpStatic: '/home/nol/node-red-static/',
225
+ //httpStatic: '/home/nol/node-red-static/', //single static source
226
+ /* OR multiple static sources can be created using an array of objects... */
227
+ //httpStatic: [
228
+ // {path: '/home/nol/pics/', root: "/img/"},
229
+ // {path: '/home/nol/reports/', root: "/doc/"},
230
+ //],
231
+
232
+ /**
233
+ * All static routes will be appended to httpStaticRoot
234
+ * e.g. if httpStatic = "/home/nol/docs" and httpStaticRoot = "/static/"
235
+ * then "/home/nol/docs" will be served at "/static/"
236
+ * e.g. if httpStatic = [{path: '/home/nol/pics/', root: "/img/"}]
237
+ * and httpStaticRoot = "/static/"
238
+ * then "/home/nol/pics/" will be served at "/static/img/"
239
+ */
240
+ //httpStaticRoot: '/static/',
223
241
 
224
242
  /*******************************************************************************
225
243
  * Runtime Settings
226
244
  * - lang
245
+ * - diagnostics
227
246
  * - logging
228
247
  * - contextStorage
229
248
  * - exportGlobalContextKeys
@@ -236,6 +255,19 @@ module.exports = {
236
255
  */
237
256
  // lang: "de",
238
257
 
258
+ /** Configure diagnostics options
259
+ * - enabled: When `enabled` is `true` (or unset), diagnostics data will
260
+ * be available at http://localhost:1880/diagnostics
261
+ * - ui: When `ui` is `true` (or unset), the action `show-system-info` will
262
+ * be available to logged in users of node-red editor
263
+ */
264
+ diagnostics: {
265
+ /** enable or disable diagnostics endpoint. Must be set to `false` to disable */
266
+ enabled: true,
267
+ /** enable or disable diagnostics display in the node-red editor. Must be set to `false` to disable */
268
+ ui: true,
269
+ },
270
+
239
271
  /** Configure the logging output */
240
272
  logging: {
241
273
  /** Only console logging is currently supported */
@@ -359,9 +391,9 @@ module.exports = {
359
391
 
360
392
  codeEditor: {
361
393
  /** Select the text editor component used by the editor.
362
- * Defaults to "ace", but can be set to "ace" or "monaco"
394
+ * As of Node-RED V3, this defaults to "monaco", but can be set to "ace" if desired
363
395
  */
364
- lib: "ace",
396
+ lib: "monaco",
365
397
  options: {
366
398
  /** The follow options only apply if the editor is set to "monaco"
367
399
  *
@@ -371,7 +403,7 @@ module.exports = {
371
403
  */
372
404
  theme: "vs",
373
405
  /** other overrides can be set e.g. fontSize, fontFamily, fontLigatures etc.
374
- * for the full list, see https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.istandaloneeditorconstructionoptions.html
406
+ * for the full list, see https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IStandaloneEditorConstructionOptions.html
375
407
  */
376
408
  //fontSize: 14,
377
409
  //fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace",