@node-red/runtime 3.1.4 → 3.1.6

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/lib/flows/Flow.js CHANGED
@@ -485,7 +485,7 @@ class Flow {
485
485
  }
486
486
  if (!key.startsWith("$parent.")) {
487
487
  if (this._env.hasOwnProperty(key)) {
488
- return (Object.hasOwn(this._env[key], 'value') && this._env[key].__clone__) ? clone(this._env[key].value) : this._env[key]
488
+ return (this._env[key] && Object.hasOwn(this._env[key], 'value') && this._env[key].__clone__) ? clone(this._env[key].value) : this._env[key]
489
489
  }
490
490
  } else {
491
491
  key = key.substring(8);
@@ -41,7 +41,7 @@ class Group {
41
41
  }
42
42
  if (!key.startsWith("$parent.")) {
43
43
  if (this._env.hasOwnProperty(key)) {
44
- return (Object.hasOwn(this._env[key], 'value') && this._env[key].__clone__) ? clone(this._env[key].value) : this._env[key]
44
+ return (this._env[key] && Object.hasOwn(this._env[key], 'value') && this._env[key].__clone__) ? clone(this._env[key].value) : this._env[key]
45
45
  }
46
46
  } else {
47
47
  key = key.substring(8);
@@ -376,7 +376,7 @@ class Subflow extends Flow {
376
376
  }
377
377
  if (!key.startsWith("$parent.")) {
378
378
  if (this._env.hasOwnProperty(key)) {
379
- return (Object.hasOwn(this._env[key], 'value') && this._env[key].__clone__) ? clone(this._env[key].value) : this._env[key]
379
+ return (this._env[key] && Object.hasOwn(this._env[key], 'value') && this._env[key].__clone__) ? clone(this._env[key].value) : this._env[key]
380
380
  }
381
381
  } else {
382
382
  key = key.substring(8);
@@ -384,7 +384,8 @@ var api = module.exports = {
384
384
  }
385
385
  }
386
386
  } else if (nodeType === "global-config") {
387
- const existingCredentialKeys = Object.keys(savedCredentials?.map || [])
387
+ savedCredentials.map = savedCredentials.map || {}
388
+ const existingCredentialKeys = Object.keys(savedCredentials.map)
388
389
  const newCredentialKeys = Object.keys(newCreds?.map || [])
389
390
  existingCredentialKeys.forEach(key => {
390
391
  if (!newCreds.map?.[key]) {
@@ -396,7 +397,7 @@ var api = module.exports = {
396
397
  })
397
398
  newCredentialKeys.forEach(key => {
398
399
  if (!/^has_/.test(key)) {
399
- if (!savedCredentials.map?.[key] || newCreds.map[key] !== '__PWRD__') {
400
+ if (!savedCredentials.map[key] || newCreds.map[key] !== '__PWRD__') {
400
401
  // This key either doesn't exist in current saved, or the
401
402
  // value has been changed
402
403
  savedCredentials.map[key] = newCreds.map[key]
@@ -77,7 +77,7 @@ var storageModuleInterface = {
77
77
  flows: flows,
78
78
  credentials: creds
79
79
  };
80
- result.rev = crypto.createHash('md5').update(JSON.stringify(result.flows)).digest("hex");
80
+ result.rev = crypto.createHash('sha256').update(JSON.stringify(result.flows)).digest("hex");
81
81
  return result;
82
82
  })
83
83
  });
@@ -95,7 +95,7 @@ var storageModuleInterface = {
95
95
 
96
96
  return credentialSavePromise.then(function() {
97
97
  return storageModule.saveFlows(flows, user).then(function() {
98
- return crypto.createHash('md5').update(JSON.stringify(config.flows)).digest("hex");
98
+ return crypto.createHash('sha256').update(JSON.stringify(config.flows)).digest("hex");
99
99
  })
100
100
  });
101
101
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/runtime",
3
- "version": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./lib/index.js",
6
6
  "repository": {
@@ -16,8 +16,8 @@
16
16
  }
17
17
  ],
18
18
  "dependencies": {
19
- "@node-red/registry": "3.1.4",
20
- "@node-red/util": "3.1.4",
19
+ "@node-red/registry": "3.1.6",
20
+ "@node-red/util": "3.1.6",
21
21
  "async-mutex": "0.4.0",
22
22
  "clone": "2.1.2",
23
23
  "express": "4.18.2",