diff --git a/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts b/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts index caaeefc1a..526bdc913 100644 --- a/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts +++ b/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts @@ -31,12 +31,12 @@ interface NodeStatus { } declare class node { - /** - * Send 1 or more messages asynchronously - * @param {object | object[]} msg The msg object - * @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true` - * @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously) - */ + /** + * Send 1 or more messages asynchronously + * @param {object | object[]} msg The msg object + * @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true` + * @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously) + */ static send(msg:object|object[], clone?:Boolean): void; /** Inform runtime this instance has completed its operation */ static done(); @@ -60,6 +60,8 @@ declare class node { public readonly id:string; /** the name of this node */ public readonly name:string; + /** the path identifier for this node */ + public readonly path:string; /** the number of outputs of this node */ public readonly outputCount:number; } @@ -93,27 +95,27 @@ declare class context { /** * Set one or multiple values in context (synchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. */ static set(name: string | string[], value?: any | any[]); /** * Set one or multiple values in context (asynchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param callback - (optional) Callback function (`(err) => {}`) */ static set(name: string | string[], value?: any | any[], callback?: Function); /** * Set one or multiple values in context (synchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param store - (optional) Name of context store */ static set(name: string | string[], value?: any | any[], store?: string); /** * Set one or multiple values in context (asynchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param store - (optional) Name of context store * @param callback - (optional) Callback function (`(err) => {}`) */ @@ -158,27 +160,27 @@ declare class flow { /** * Set one or multiple values in context (synchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. */ static set(name: string | string[], value?: any | any[]); /** * Set one or multiple values in context (asynchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param callback - (optional) Callback function (`(err) => {}`) */ static set(name: string | string[], value?: any | any[], callback?: Function); /** * Set one or multiple values in context (synchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param store - (optional) Name of context store */ static set(name: string | string[], value?: any | any[], store?: string); /** * Set one or multiple values in context (asynchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param store - (optional) Name of context store * @param callback - (optional) Callback function (`(err) => {}`) */ @@ -225,32 +227,32 @@ declare class global { /** * Set one or multiple values in context (synchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. */ static set(name: string | string[], value?: any | any[]); /** * Set one or multiple values in context (asynchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param callback - (optional) Callback function (`(err) => {}`) */ static set(name: string | string[], value?: any | any[], callback?: Function); /** * Set one or multiple values in context (synchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param store - (optional) Name of context store */ static set(name: string | string[], value?: any | any[], store?: string); /** * Set one or multiple values in context (asynchronous). * @param name - Name (or array of names) to set in context - * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. + * @param value - The value (or array of values) to store in context. If the value(s) are null/undefined, the context item(s) will be removed. * @param store - (optional) Name of context store * @param callback - (optional) Callback function (`(err) => {}`) */ static set(name: string | string[], value?: any | any[], store?: string, callback?: Function); - + /** Get an array of the keys in the context store */ static keys(): Array; /** Get an array of the keys in the context store */ diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.js b/packages/node_modules/@node-red/nodes/core/function/10-function.js index d948b80f5..b84ee8571 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-function.js +++ b/packages/node_modules/@node-red/nodes/core/function/10-function.js @@ -112,6 +112,7 @@ module.exports = function(RED) { "var node = {"+ "id:__node__.id,"+ "name:__node__.name,"+ + "path:__node__.path,"+ "outputCount:__node__.outputCount,"+ "log:__node__.log,"+ "error:__node__.error,"+ @@ -163,6 +164,7 @@ module.exports = function(RED) { __node__: { id: node.id, name: node.name, + path: node._path, outputCount: node.outputs, log: function() { node.log.apply(node, arguments); @@ -344,6 +346,7 @@ module.exports = function(RED) { var node = { id:__node__.id, name:__node__.name, + path:__node__.path, outputCount:__node__.outputCount, log:__node__.log, error:__node__.error, @@ -366,6 +369,7 @@ module.exports = function(RED) { var node = { id:__node__.id, name:__node__.name, + path:__node__.path, outputCount:__node__.outputCount, log:__node__.log, error:__node__.error, diff --git a/packages/node_modules/@node-red/runtime/lib/flows/util.js b/packages/node_modules/@node-red/runtime/lib/flows/util.js index 8e46d4877..be436eb22 100644 --- a/packages/node_modules/@node-red/runtime/lib/flows/util.js +++ b/packages/node_modules/@node-red/runtime/lib/flows/util.js @@ -85,6 +85,7 @@ function createNode(flow,config) { try { Object.defineProperty(conf,'_module', {value: typeRegistry.getNodeInfo(type), enumerable: false, writable: true }) Object.defineProperty(conf,'_flow', {value: flow, enumerable: false, writable: true }) + Object.defineProperty(conf,'_path', {value: `${flow.path}/${config._alias||config.id}`, enumerable: false, writable: true }) newNode = new nodeTypeConstructor(conf); } catch (err) { Log.log({ diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/Node.js b/packages/node_modules/@node-red/runtime/lib/nodes/Node.js index bdd0d284c..837e36386 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/Node.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/Node.js @@ -62,6 +62,9 @@ function Node(n) { if (n._module) { Object.defineProperty(this,'_module', {value: n._module, enumerable: false, writable: true }) } + if (n._path) { + Object.defineProperty(this,'_path', {value: n._path, enumerable: false, writable: true }) + } this.updateWires(n.wires); }