@node-red/runtime 4.1.0 → 4.1.2

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.
@@ -22,6 +22,31 @@ var api = module.exports = {
22
22
  return runtime.plugins.getPlugin(opts.id);
23
23
  },
24
24
 
25
+ /**
26
+ * Gets the info of an individual plugin set
27
+ * @param {Object} opts
28
+ * @param {User} opts.user - the user calling the api
29
+ * @param {String} opts.id - the id of the plugin set to return
30
+ * @param {Object} opts.req - the request to log (optional)
31
+ * @return {Promise<PluginInfo>} - the plugin information
32
+ * @memberof @node-red/runtime_plugins
33
+ */
34
+ getPluginInfo: async function(opts) {
35
+ const id = opts.id;
36
+ const result = runtime.plugins.getPluginInfo(id);
37
+ if (result) {
38
+ runtime.log.audit({ event: "plugins.info.get", id: id }, opts.req);
39
+ delete result.loaded;
40
+ return result;
41
+ } else {
42
+ runtime.log.audit({ event: "plugins.info.get", id: id, error: "not_found" }, opts.req);
43
+ var err = new Error("Plugin not found");
44
+ err.code = "not_found";
45
+ err.status = 404;
46
+ throw err;
47
+ }
48
+ },
49
+
25
50
  /**
26
51
  * Gets all plugin definitions of a given type
27
52
  * @param {Object} opts
@@ -67,12 +92,12 @@ var api = module.exports = {
67
92
  },
68
93
 
69
94
  /**
70
- * Gets the editor content for one registered plugin
95
+ * Gets an individual plugin's html content
71
96
  * @param {Object} opts
72
97
  * @param {User} opts.user - the user calling the api
73
98
  * @param {User} opts.user - the user calling the api
74
99
  * @param {Object} opts.req - the request to log (optional)
75
- * @return {Promise<NodeInfo>} - the plugin information
100
+ * @return {Promise<string>} - the plugin html content
76
101
  * @memberof @node-red/runtime_plugins
77
102
  */
78
103
  getPluginConfig: async function(opts) {
@@ -81,7 +106,7 @@ var api = module.exports = {
81
106
  return;
82
107
  }
83
108
  runtime.log.audit({event: "plugins.configs.get"}, opts.req);
84
- return runtime.plugins.getPluginConfig(opts.module, opts.lang);
109
+ return runtime.plugins.getPluginConfig(opts.id, opts.lang);
85
110
  },
86
111
 
87
112
  /**
package/lib/flows/Flow.js CHANGED
@@ -268,6 +268,9 @@ class Flow {
268
268
  try {
269
269
  var subflowDefinition = this.flow.subflows[node.subflow]||this.global.subflows[node.subflow]
270
270
  // console.log("NEED TO CREATE A SUBFLOW",id,node.subflow);
271
+ // Ensure the path property is set on the instance node so NR_SUBFLOW_PATH env is evaluated properly
272
+ Object.defineProperty(node,'_path', {value: `${this.path}/${node._alias||node.id}`, enumerable: false, writable: true })
273
+
271
274
  this.subflowInstanceNodes[id] = true;
272
275
  var subflow = Subflow.create(
273
276
  this,
package/lib/flows/util.js CHANGED
@@ -229,7 +229,11 @@ async function createNode(flow,config) {
229
229
  instanceConfig.env = nodeTypeConstructor.subflow.env.map(nodeProp => {
230
230
  var nodePropType;
231
231
  var nodePropValue = config[nodeProp.name];
232
- if (nodeProp.type === "cred") {
232
+ if (nodeProp.ui?.type === "conf-types" && /^\${[^}]+}$/.test(nodePropValue)) {
233
+ const valName = nodePropValue.substring(2, nodePropValue.length - 1);
234
+ nodePropValue = flow.getSetting(valName)
235
+ nodePropType = "conf-type";
236
+ } else if (nodeProp.type === "cred") {
233
237
  nodePropType = "cred";
234
238
  } else {
235
239
  switch(typeof config[nodeProp.name]) {
@@ -172,9 +172,10 @@ function installModule(module,version,url) {
172
172
  if (info.pending_version) {
173
173
  events.emit("runtime-event",{id:"node/upgraded",retain:false,payload:{module:info.name,version:info.pending_version}});
174
174
  } else {
175
- if (!info.nodes.length && info.plugins.length) {
175
+ if (info.plugins.length) {
176
176
  events.emit("runtime-event",{id:"plugin/added",retain:false,payload:info.plugins});
177
- } else {
177
+ }
178
+ if (info.nodes.length) {
178
179
  events.emit("runtime-event",{id:"node/added",retain:false,payload:info.nodes});
179
180
  }
180
181
  }
package/lib/plugins.js CHANGED
@@ -4,6 +4,7 @@ module.exports = {
4
4
  init: function() {},
5
5
  registerPlugin: registry.registerPlugin,
6
6
  getPlugin: registry.getPlugin,
7
+ getPluginInfo: registry.getPluginInfo,
7
8
  getPluginsByType: registry.getPluginsByType,
8
9
  getPluginList: registry.getPluginList,
9
10
  getPluginConfigs: registry.getPluginConfigs,
@@ -92,7 +92,7 @@ function init(_settings, _runtime) {
92
92
 
93
93
  if (projectsEnabled) {
94
94
  return sshTools.init(settings,runtime).then(function() {
95
- gitTools.init(_settings).then(function(gitConfig) {
95
+ return gitTools.init(_settings).then(function(gitConfig) {
96
96
  if (!gitConfig || /^1\./.test(gitConfig.version)) {
97
97
  if (!gitConfig) {
98
98
  projectLogMessages.push(log._("storage.localfilesystem.projects.git-not-found"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/runtime",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./lib/index.js",
6
6
  "repository": {
@@ -16,12 +16,12 @@
16
16
  }
17
17
  ],
18
18
  "dependencies": {
19
- "@node-red/registry": "4.1.0",
20
- "@node-red/util": "4.1.0",
19
+ "@node-red/registry": "4.1.2",
20
+ "@node-red/util": "4.1.2",
21
21
  "async-mutex": "0.5.0",
22
22
  "clone": "2.1.2",
23
23
  "cronosjs": "1.7.1",
24
- "express": "4.21.2",
24
+ "express": "4.22.1",
25
25
  "fs-extra": "11.3.0",
26
26
  "got": "12.6.1",
27
27
  "json-stringify-safe": "5.0.1",