@tachybase/plugin-adapter-red-node 1.3.25 → 1.5.0
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/dist/externalVersion.js +1 -1
- package/dist/node_modules/@node-red/editor-api/package.json +1 -1
- package/dist/node_modules/@node-red/runtime/466.index.js +10135 -0
- package/dist/node_modules/@node-red/runtime/lib/api/context.js +26 -6
- package/dist/node_modules/@node-red/runtime/lib/api/settings.js +14 -0
- package/dist/node_modules/@node-red/runtime/lib/flows/Flow.js +14 -0
- package/dist/node_modules/@node-red/runtime/lib/flows/Group.js +8 -0
- package/dist/node_modules/@node-red/runtime/lib/flows/util.js +23 -2
- package/dist/node_modules/@node-red/runtime/lib/index.js +55 -55
- package/dist/node_modules/@node-red/runtime/lib/nodes/index.js +3 -2
- package/dist/node_modules/@node-red/runtime/lib/storage/localfilesystem/library.js +1 -1
- package/dist/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/git/index.js +2 -0
- package/dist/node_modules/@node-red/runtime/lib/telemetry/index.js +213 -0
- package/dist/node_modules/@node-red/runtime/lib/telemetry/metrics/01-core.js +5 -0
- package/dist/node_modules/@node-red/runtime/lib/telemetry/metrics/02-os.js +9 -0
- package/dist/node_modules/@node-red/runtime/lib/telemetry/metrics/03-env.js +8 -0
- package/dist/node_modules/@node-red/runtime/metrics/01-core.js +5 -0
- package/dist/node_modules/@node-red/runtime/metrics/02-os.js +9 -0
- package/dist/node_modules/@node-red/runtime/metrics/03-env.js +8 -0
- package/dist/node_modules/@node-red/runtime/node_modules/.bin/semver +21 -0
- package/dist/node_modules/@node-red/runtime/package.json +1 -1
- package/dist/node_modules/@node-red/util/package.json +1 -1
- package/dist/node_modules/express/package.json +1 -1
- package/package.json +3 -3
|
@@ -96,7 +96,11 @@ var api = module.exports = {
|
|
|
96
96
|
} else if (scope === 'node') {
|
|
97
97
|
var node = runtime.nodes.getNode(id);
|
|
98
98
|
if (node) {
|
|
99
|
-
|
|
99
|
+
if (/^subflow:/.test(node.type)) {
|
|
100
|
+
ctx = runtime.nodes.getContext(node.id);
|
|
101
|
+
} else {
|
|
102
|
+
ctx = node.context();
|
|
103
|
+
}
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
if (ctx) {
|
|
@@ -104,13 +108,25 @@ var api = module.exports = {
|
|
|
104
108
|
store = store || availableStores.default;
|
|
105
109
|
ctx.get(key,store,function(err, v) {
|
|
106
110
|
if (opts.keysOnly) {
|
|
111
|
+
const result = {}
|
|
107
112
|
if (Array.isArray(v)) {
|
|
108
|
-
|
|
113
|
+
result.format = `array[${v.length}]`
|
|
109
114
|
} else if (typeof v === 'object') {
|
|
110
|
-
|
|
115
|
+
result.keys = Object.keys(v).map(k => {
|
|
116
|
+
if (Array.isArray(v[k])) {
|
|
117
|
+
return { key: k, format: `array[${v[k].length}]`, length: v[k].length }
|
|
118
|
+
} else if (typeof v[k] === 'object') {
|
|
119
|
+
return { key: k, format: 'object' }
|
|
120
|
+
} else {
|
|
121
|
+
return { key: k }
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
result.format = 'object'
|
|
111
125
|
} else {
|
|
112
|
-
|
|
126
|
+
result.keys = []
|
|
113
127
|
}
|
|
128
|
+
resolve({ [store]: result })
|
|
129
|
+
return
|
|
114
130
|
}
|
|
115
131
|
var encoded = util.encodeObject({msg:v});
|
|
116
132
|
if (store !== availableStores.default) {
|
|
@@ -147,7 +163,7 @@ var api = module.exports = {
|
|
|
147
163
|
}
|
|
148
164
|
return
|
|
149
165
|
}
|
|
150
|
-
result[store] = { keys }
|
|
166
|
+
result[store] = { keys: keys.map(key => { return { key }}) }
|
|
151
167
|
c--;
|
|
152
168
|
if (c === 0) {
|
|
153
169
|
if (!errorReported) {
|
|
@@ -225,7 +241,11 @@ var api = module.exports = {
|
|
|
225
241
|
} else if (scope === 'node') {
|
|
226
242
|
var node = runtime.nodes.getNode(id);
|
|
227
243
|
if (node) {
|
|
228
|
-
|
|
244
|
+
if (/^subflow:/.test(node.type)) {
|
|
245
|
+
ctx = runtime.nodes.getContext(node.id);
|
|
246
|
+
} else {
|
|
247
|
+
ctx = node.context();
|
|
248
|
+
}
|
|
229
249
|
}
|
|
230
250
|
}
|
|
231
251
|
if (ctx) {
|
|
@@ -161,6 +161,8 @@ var api = module.exports = {
|
|
|
161
161
|
safeSettings.diagnostics.ui = false; // cannot have UI without endpoint
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
safeSettings.telemetryEnabled = runtime.telemetry.isEnabled()
|
|
165
|
+
|
|
164
166
|
safeSettings.runtimeState = {
|
|
165
167
|
//unless runtimeState.ui and runtimeState.enabled are explicitly true, they will default to false.
|
|
166
168
|
enabled: !!runtime.settings.runtimeState && runtime.settings.runtimeState.enabled === true,
|
|
@@ -213,7 +215,19 @@ var api = module.exports = {
|
|
|
213
215
|
}
|
|
214
216
|
var currentSettings = runtime.settings.getUserSettings(username)||{};
|
|
215
217
|
currentSettings = extend(currentSettings, opts.settings);
|
|
218
|
+
|
|
216
219
|
try {
|
|
220
|
+
if (currentSettings.hasOwnProperty("telemetryEnabled")) {
|
|
221
|
+
// This is a global setting that is being set by the user. It should
|
|
222
|
+
// not be stored per-user as it applies to the whole runtime.
|
|
223
|
+
const telemetryEnabled = currentSettings.telemetryEnabled;
|
|
224
|
+
delete currentSettings.telemetryEnabled;
|
|
225
|
+
if (telemetryEnabled) {
|
|
226
|
+
runtime.telemetry.enable()
|
|
227
|
+
} else {
|
|
228
|
+
runtime.telemetry.disable()
|
|
229
|
+
}
|
|
230
|
+
}
|
|
217
231
|
return runtime.settings.setUserSettings(username, currentSettings).then(function() {
|
|
218
232
|
runtime.log.audit({event: "settings.update",username:username}, opts.req);
|
|
219
233
|
return;
|
|
@@ -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,
|
|
@@ -675,6 +678,9 @@ class Flow {
|
|
|
675
678
|
count: count
|
|
676
679
|
}
|
|
677
680
|
};
|
|
681
|
+
if (logMessage.hasOwnProperty('code')) {
|
|
682
|
+
errorMessage.error.code = logMessage.code;
|
|
683
|
+
}
|
|
678
684
|
if (logMessage.hasOwnProperty('stack')) {
|
|
679
685
|
errorMessage.error.stack = logMessage.stack;
|
|
680
686
|
}
|
|
@@ -719,6 +725,14 @@ class Flow {
|
|
|
719
725
|
});
|
|
720
726
|
}
|
|
721
727
|
|
|
728
|
+
getContext(scope) {
|
|
729
|
+
if (scope === 'flow') {
|
|
730
|
+
return this.context
|
|
731
|
+
} else if (scope === 'global') {
|
|
732
|
+
return context.get('global')
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
722
736
|
dump() {
|
|
723
737
|
console.log("==================")
|
|
724
738
|
console.log(this.TYPE, this.id);
|
|
@@ -100,7 +100,24 @@ async function evaluateEnvProperties(flow, env, credentials) {
|
|
|
100
100
|
}
|
|
101
101
|
} else if (type ==='jsonata') {
|
|
102
102
|
pendingEvaluations.push(new Promise((resolve, _) => {
|
|
103
|
-
redUtil.evaluateNodeProperty(value, 'jsonata',
|
|
103
|
+
redUtil.evaluateNodeProperty(value, 'jsonata',{
|
|
104
|
+
// Fake a node object to provide access to _flow and context
|
|
105
|
+
_flow: flow,
|
|
106
|
+
context: () => {
|
|
107
|
+
return {
|
|
108
|
+
flow: {
|
|
109
|
+
get: (value, store, callback) => {
|
|
110
|
+
return flow.getContext('flow').get(value, store, callback)
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
global: {
|
|
114
|
+
get: (value, store, callback) => {
|
|
115
|
+
return flow.getContext('global').get(value, store, callback)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, null, (err, result) => {
|
|
104
121
|
if (!err) {
|
|
105
122
|
if (typeof result === 'object') {
|
|
106
123
|
result = { value: result, __clone__: true}
|
|
@@ -212,7 +229,11 @@ async function createNode(flow,config) {
|
|
|
212
229
|
instanceConfig.env = nodeTypeConstructor.subflow.env.map(nodeProp => {
|
|
213
230
|
var nodePropType;
|
|
214
231
|
var nodePropValue = config[nodeProp.name];
|
|
215
|
-
if (nodeProp.type === "
|
|
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") {
|
|
216
237
|
nodePropType = "cred";
|
|
217
238
|
} else {
|
|
218
239
|
switch(typeof config[nodeProp.name]) {
|