diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js index a62c552e1..2decabc52 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editors/monaco.js @@ -570,6 +570,7 @@ RED.editor.codeEditor.monaco = (function() { createMonacoCompletionItem("set (flow context)", 'flow.set("${1:name}", ${1:value});','Set a value in flow context',range), createMonacoCompletionItem("get (global context)", 'global.get("${1:name}");','Get a value from global context',range), createMonacoCompletionItem("set (global context)", 'global.set("${1:name}", ${1:value});','Set a value in global context',range), + createMonacoCompletionItem("get (env)", 'env.get("${1:name}");','Get env variable value',range), createMonacoCompletionItem("cloneMessage (RED.util)", 'RED.util.cloneMessage(${1:msg});', ["```typescript", "RED.util.cloneMessage(msg: T): T", 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 95060b8ff..ab120318e 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 @@ -1,15 +1,18 @@ +/* NOTE: Do not edit directly! This file is generated using \`npm run update-types\` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */ + + interface NodeMessage { topic?: string; payload?: any; _msgid?: string; - [other: any]: any; //permit other properties + [other: string]: any; //permit other properties } /** @type {NodeMessage} the `msg` object */ -var msg: NodeMessage; +declare var msg: NodeMessage; /** @type {string} the id of the incoming `msg` (alias of msg._msgid) */ -const __msgid__:string; +declare const __msgid__:string; /** * @typedef NodeStatus @@ -46,11 +49,11 @@ declare class node { * ``` * @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously) */ - static send(msg:object, clone:Boolean=true); + static send(msg:object, clone?:Boolean); /** Inform runtime this instance has completed its operation */ static done(); /** Send an error to the console and debug side bar. Include `msg` in the 2nd parameter to trigger the catch node. */ - static error(err:string|Error, msg:object=null); + static error(err:string|Error, msg?:object); /** Log a warn message to the console and debug sidebar */ static warn(warning:string|Object); /** Log an info message to the console (not sent to sidebar)' */ @@ -69,33 +72,37 @@ declare class node { */ static status(status:NodeStatus); /** the id of this node */ - public static readonly id:string; + public readonly id:string; /** the name of this node */ - public static readonly name:string; + public readonly name:string; /** the number of outputs of this node */ - public static readonly outputCount:Number; + public readonly outputCount:Number; } declare class context { /** Get a value from context */ - static get(name:string, store:string="default"); + static get(name:string, store?:string); /** Store a value in context */ - static set(name:string, value:Any, store:string="default"); + static set(name:string, value:any, store?:string); /** Get an array of the keys in the context store */ - static keys(store:string="default"):Array ; + static keys(store?:string):Array ; } declare class flow { /** Get a value from flow context */ - static get(name:string, store:string="default"); + static get(name:string, store?:string); /** Store a value in flow context */ - static set(name:string, value:Any, store:string="default"); + static set(name:string, value:any, store?:string); /** Get an array of the keys in the flow context store */ - static keys(store:string="default"):Array ; + static keys(store?:string):Array ; } declare class global { /** Get a value from global context */ - static get(name:string, store:string="default"); + static get(name:string, store?:string); /** Store a value in global context */ - static set(name:string, value:Any, store:string="default"); + static set(name:string, value:any, store?:string); /** Get an array of the keys in the global context store */ - static keys(store:string="default"):Array ; + static keys(store?:string):Array ; +} +declare class env { + /** Get an environment variable value */ + static get(name:string); } diff --git a/packages/node_modules/@node-red/editor-client/src/types/node-red/util.d.ts b/packages/node_modules/@node-red/editor-client/src/types/node-red/util.d.ts index 406fa160f..f9e56976f 100644 --- a/packages/node_modules/@node-red/editor-client/src/types/node-red/util.d.ts +++ b/packages/node_modules/@node-red/editor-client/src/types/node-red/util.d.ts @@ -1,4 +1,7 @@ +/* NOTE: Do not edit directly! This file is generated using \`npm run update-types\` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */ + + /* How to generate... 1. Generate from packages\node_modules\@node-red\util\lib\util.js using `npx typescript` and a tsconfig.json of... @@ -22,7 +25,7 @@ declare namespace RED { /** * Utility functions for the node-red function sandbox */ - declare namespace util { + namespace util { /** * Encode an object to JSON without losing information about non-JSON types