diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index c8abada3e..0300a220f 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -936,6 +936,9 @@ "invalid-expr": "Invalid JSONata expression:\n __message__", "invalid-msg": "Invalid example JSON message:\n __message__", "context-unsupported": "Cannot test context functions\n $flowContext or $globalContext", + "env-unsupported": "Cannot test $env function", + "moment-unsupported": "Cannot test $moment function", + "clone-unsupported": "Cannot test $clone function", "eval": "Error evaluating expression:\n __message__" } }, diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index 9c71c0a80..b07b8e583 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -936,6 +936,9 @@ "invalid-expr": "不正なJSONata式:\n __message__", "invalid-msg": "不正なJSONメッセージ例:\n __message__", "context-unsupported": "$flowContext や $globalContextの\nコンテキスト関数をテストできません", + "env-unsupported": "$env関数はテストできません", + "moment-unsupported": "$moment関数はテストできません", + "clone-unsupported": "$clone関数はテストできません", "eval": "式評価エラー:\n __message__" } }, 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 497116125..68b9a487e 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 @@ -100,7 +100,7 @@ RED.editor.codeEditor.monaco = (function() { "node-red-util": {package: "node-red", module: "util", path: "node-red/util.d.ts" }, "node-red-func": {package: "node-red", module: "func", path: "node-red/func.d.ts" }, } - const defaultServerSideTypes = [ knownModules["node-red-util"], knownModules["node-red-func"], knownModules["globals"], knownModules["console"], knownModules["buffer"] ]; + const defaultServerSideTypes = [ knownModules["node-red-util"], knownModules["node-red-func"], knownModules["globals"], knownModules["console"], knownModules["buffer"] , knownModules["util"] ]; const modulesCache = {}; diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js index b3c4c3848..d470e14f2 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js @@ -255,6 +255,9 @@ var currentExpression = expressionEditor.getValue(); var expr; var usesContext = false; + var usesEnv = false; + var usesMoment = false; + var usesClone = false; var legacyMode = /(^|[^a-zA-Z0-9_'".])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression); $(".red-ui-editor-type-expression-legacy").toggle(legacyMode); try { @@ -267,6 +270,18 @@ usesContext = true; return null; }); + expr.assign("env", function(name) { + usesEnv = true; + return null; + }); + expr.assign("moment", function(name) { + usesMoment = true; + return null; + }); + expr.assign("clone", function(name) { + usesClone = true; + return null; + }); } catch(err) { testResultEditor.setValue(RED._("expressionEditor.errors.invalid-expr",{message:err.message}),-1); return; @@ -284,6 +299,18 @@ testResultEditor.setValue(RED._("expressionEditor.errors.context-unsupported"),-1); return; } + if (usesEnv) { + testResultEditor.setValue(RED._("expressionEditor.errors.env-unsupported"),-1); + return; + } + if (usesMoment) { + testResultEditor.setValue(RED._("expressionEditor.errors.moment-unsupported"),-1); + return; + } + if (usesClone) { + testResultEditor.setValue(RED._("expressionEditor.errors.clone-unsupported"),-1); + return; + } var formattedResult; if (result !== undefined) { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js index 9f20cc674..928793610 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js @@ -175,9 +175,19 @@ RED.palette = (function() { $('').appendTo(popOverContent) } - var safeType = type.replace(/'/g,"\\'"); + const safeType = type.replace(/'/g,"\\'"); + const wrapStr = function (str) { + if(str.indexOf(' ') >= 0) { + return '"' + str + '"' + } + return str + } - $('').appendTo(popOverContent) + $('') + .appendTo(popOverContent) + .on('click', function() { + RED.search.show('type:' + wrapStr(safeType)) + }) $('').appendTo(popOverContent) $('

',{style:"font-size: 0.8em"}).text(metaData).appendTo(popOverContent); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projects.js b/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projects.js index 190561e15..c198b34db 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projects.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projects.js @@ -545,7 +545,7 @@ RED.projects = (function() { var sshwarningRow = $('

').hide().appendTo(subrow); $('
'+RED._("projects.clone-project.ssh-key-desc")+'
').appendTo(sshwarningRow); subrow = $('
').appendTo(sshwarningRow); - $('').appendTo(subrow).on("click", function(e) { + $('').appendTo(subrow).on("click", function(e) { e.preventDefault(); dialog.dialog( "close" ); RED.userSettings.show('gitconfig'); @@ -1171,11 +1171,11 @@ RED.projects = (function() { row = $('
').appendTo(container); - var openProject = $('').appendTo(row); - var createAsEmpty = $('').appendTo(row); - // var createAsCopy = $('').appendTo(row); - var createAsClone = $('').appendTo(row); - // var createAsClone = $('').appendTo(row); + var openProject = $('').appendTo(row); + var createAsEmpty = $('').appendTo(row); + // var createAsCopy = $('').appendTo(row); + var createAsClone = $('').appendTo(row); + // var createAsClone = $('').appendTo(row); row.find(".red-ui-projects-dialog-screen-create-type").on("click", function(evt) { evt.preventDefault(); container.find(".red-ui-projects-dialog-screen-create-type").removeClass('selected'); @@ -1271,7 +1271,7 @@ RED.projects = (function() { var credentialsLeftBox = $('
').appendTo(credentialsBox); var credentialsEnabledBox = $('
').appendTo(credentialsLeftBox); - $('').appendTo(credentialsEnabledBox); + $('').appendTo(credentialsEnabledBox); var credentialsDisabledBox = $('
').appendTo(credentialsLeftBox); $('').appendTo(credentialsDisabledBox); @@ -1397,7 +1397,7 @@ RED.projects = (function() { var sshwarningRow = $('
').hide().appendTo(subrow); $('
'+RED._("projects.create.desc2")+'
').appendTo(sshwarningRow); subrow = $('
').appendTo(sshwarningRow); - $('').appendTo(subrow).on("click", function(e) { + $('').appendTo(subrow).on("click", function(e) { e.preventDefault(); $('#red-ui-projects-dialog-cancel').trigger("click"); RED.userSettings.show('gitconfig'); @@ -1631,14 +1631,14 @@ RED.projects = (function() { function deleteProject(row,name,done) { var cover = $('
').on("click", function(evt) { evt.stopPropagation(); }).appendTo(row); $('').text(RED._("projects.delete.confirm")).appendTo(cover); - $('') + $('') .appendTo(cover) .on("click", function(e) { e.stopPropagation(); cover.remove(); done(true); }); - $('') + $('') .appendTo(cover) .on("click", function(e) { e.stopPropagation(); @@ -1822,7 +1822,7 @@ RED.projects = (function() { header.addClass("selectable"); var tools = $('
').appendTo(header); - $('') + $('') .appendTo(tools) .on("click", function(e) { e.stopPropagation(); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js index f9cc79f08..3903a4a0a 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js @@ -106,38 +106,51 @@ RED.search = (function() { return val; } - function search(val) { - var results = []; - var typeFilter; - var m = /(?:^| )type:([^ ]+)/.exec(val); - if (m) { - val = val.replace(/(?:^| )type:[^ ]+/,""); - typeFilter = m[1]; + function extractType(val, flags) { + // extracts: type:XYZ & type:"X Y Z" + const regEx = /(?:type):\s*(?:"([^"]+)"|([^" ]+))/; + let m + while ((m = regEx.exec(val)) !== null) { + // avoid infinite loops with zero-width matches + if (m.index === regEx.lastIndex) { + regEx.lastIndex++; + } + val = val.replace(m[0]," ").trim() + const flag = m[2] || m[1] // quoted entries in capture group 1, unquoted in capture group 2 + flags.type = flags.type || []; + flags.type.push(flag); } - var flags = {}; + return val; + } + + function search(val) { + const results = []; + const flags = {}; val = extractFlag(val,"invalid",flags); val = extractFlag(val,"unused",flags); val = extractFlag(val,"config",flags); val = extractFlag(val,"subflow",flags); val = extractFlag(val,"hidden",flags); val = extractFlag(val,"modified",flags); - val = extractValue(val,"flow",flags);// flow:active or flow: + val = extractValue(val,"flow",flags);// flow:current or flow: val = extractValue(val,"uses",flags);// uses: + val = extractType(val,flags);// type: val = val.trim(); - var hasFlags = Object.keys(flags).length > 0; + const hasFlags = Object.keys(flags).length > 0; + const hasTypeFilter = flags.type && flags.type.length > 0 if (flags.flow && flags.flow.indexOf("current") >= 0) { let idx = flags.flow.indexOf("current"); - flags.flow[idx] = RED.workspaces.active();//convert active to flow ID + flags.flow[idx] = RED.workspaces.active();//convert 'current' to active flow ID } if (flags.flow && flags.flow.length) { flags.flow = [ ...new Set(flags.flow) ]; //deduplicate } - if (val.length > 0 || typeFilter || hasFlags) { + if (val.length > 0 || hasFlags) { val = val.toLowerCase(); - var i; - var j; - var list = []; - var nodes = {}; + let i; + let j; + let list = []; + const nodes = {}; let keys = []; if (flags.uses) { keys = flags.uses; @@ -145,10 +158,10 @@ RED.search = (function() { keys = Object.keys(index); } for (i=0;i -1) { - var ids = Object.keys(index[key]||{}); + const key = keys[i]; + const kpos = val ? keys[i].indexOf(val) : -1; + if (kpos > -1 || (val === "" && hasFlags)) { + const ids = Object.keys(index[key]||{}); for (j=0;j -1) { + nodes[node.node.id] = nodes[node.node.id] || { node: node.node, label: node.label }; - nodes[node.node.id].index = Math.min(nodes[node.node.id].index||Infinity,kpos); + nodes[node.node.id].index = Math.min(nodes[node.node.id].index || Infinity, typeIndex > -1 ? typeIndex : kpos); } } } 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 ae411f33c..fd2adcbd8 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 @@ -14,6 +14,9 @@ declare var msg: NodeMessage; /** @type {string} the id of the incoming `msg` (alias of msg._msgid) */ declare const __msgid__:string; +declare const util:typeof import('util') +declare const promisify:typeof import('util').promisify + /** * @typedef NodeStatus * @type {object} diff --git a/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js index 3d1af605c..2431a8bbd 100644 --- a/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js +++ b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js @@ -160,6 +160,7 @@ '$base64encode':{ args:[ ]}, '$boolean':{ args:[ 'arg' ]}, '$ceil':{ args:[ 'number' ]}, + '$clone': { args:[ 'arg' ]}, '$contains':{ args:[ 'str', 'pattern' ]}, '$count':{ args:[ 'array' ]}, '$decodeUrl':{ args:[ 'str' ]}, diff --git a/packages/node_modules/@node-red/nodes/core/common/24-complete.html b/packages/node_modules/@node-red/nodes/core/common/24-complete.html index a6a7a2a45..b2d406bb5 100644 --- a/packages/node_modules/@node-red/nodes/core/common/24-complete.html +++ b/packages/node_modules/@node-red/nodes/core/common/24-complete.html @@ -1,6 +1,6 @@