From 514e31aef9098bab1ace39caaf0252bde0f2a3e3 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 14 Nov 2018 18:29:27 +0000 Subject: [PATCH 01/25] refuse to enable palette if npm too old --- .../node_modules/@node-red/registry/lib/installer.js | 9 +++++++-- .../@node-red/runtime/locales/en-US/runtime.json | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/registry/lib/installer.js b/packages/node_modules/@node-red/registry/lib/installer.js index 66768a620..c5095236e 100644 --- a/packages/node_modules/@node-red/registry/lib/installer.js +++ b/packages/node_modules/@node-red/registry/lib/installer.js @@ -235,12 +235,17 @@ function checkPrereq() { return Promise.resolve(); } else { return new Promise(resolve => { - child_process.execFile(npmCommand,['-v'],function(err) { + child_process.execFile(npmCommand,['-v'],function(err,stdout) { if (err) { log.info(log._("server.palette-editor.npm-not-found")); paletteEditorEnabled = false; } else { - paletteEditorEnabled = true; + if (parseInt(stdout.split(".")[0]) < 3) { + log.info(log._("server.palette-editor.npm-too-old")); + paletteEditorEnabled = false; + } else { + paletteEditorEnabled = true; + } } resolve(); }); diff --git a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json index 8d47d8215..9fbf5f029 100644 --- a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json +++ b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json @@ -13,7 +13,8 @@ "loading": "Loading palette nodes", "palette-editor": { "disabled": "Palette editor disabled : user settings", - "npm-not-found": "Palette editor disabled : npm command not found" + "npm-not-found": "Palette editor disabled : npm command not found", + "npm-too-old": "Palette editor disabled : npm version too old - please update" }, "errors": "Failed to register __count__ node type", "errors_plural": "Failed to register __count__ node types", From 4eb3bd496b5338fa3792fbaf8322c1aaf01ef6c8 Mon Sep 17 00:00:00 2001 From: nakanishi Date: Tue, 4 Dec 2018 15:39:01 +0000 Subject: [PATCH 02/25] Add redirectList property in msg of http-request node --- .../@node-red/nodes/core/io/21-httprequest.js | 33 ++++++++---- .../locales/en-US/io/21-httprequest.html | 2 + .../nodes/locales/ja/io/21-httprequest.html | 2 + test/nodes/core/io/21-httprequest_spec.js | 54 +++++++++++++++++++ 4 files changed, 81 insertions(+), 10 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js b/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js index 594debc2e..adc1afafe 100644 --- a/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js +++ b/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js @@ -131,8 +131,16 @@ module.exports = function(RED) { if (msg.hasOwnProperty('followRedirects')) { opts.followRedirect = msg.followRedirects; } + var redirectList = []; if (!opts.hasOwnProperty('followRedirect') || opts.followRedirect) { opts.followRedirect = function(res) { + var redirectInfo = { + location: res.headers.location, + }; + if (res.headers.hasOwnProperty('set-cookie')) { + redirectInfo.cookies = extractCookies(res.headers['set-cookie']); + } + redirectList.push(redirectInfo); if (this.headers.cookie) { delete this.headers.cookie; } @@ -256,17 +264,9 @@ module.exports = function(RED) { msg.headers = res.headers; msg.responseUrl = res.request.uri.href; msg.payload = body; - + msg.redirectList = redirectList; if (msg.headers.hasOwnProperty('set-cookie')) { - msg.responseCookies = {}; - msg.headers['set-cookie'].forEach(function(c) { - var parsedCookie = cookie.parse(c); - var eq_idx = c.indexOf('='); - var key = c.substr(0, eq_idx).trim() - parsedCookie.value = parsedCookie[key]; - delete parsedCookie[key]; - msg.responseCookies[key] = parsedCookie; - }); + msg.responseCookies = extractCookies(msg.headers['set-cookie']); } msg.headers['x-node-red-request-node'] = hashSum(msg.headers); // msg.url = url; // revert when warning above finally removed @@ -299,6 +299,19 @@ module.exports = function(RED) { this.on("close",function() { node.status({}); }); + + function extractCookies(setCookie) { + var cookies = {}; + setCookie.forEach(function(c) { + var parsedCookie = cookie.parse(c); + var eq_idx = c.indexOf('='); + var key = c.substr(0, eq_idx).trim() + parsedCookie.value = parsedCookie[key]; + delete parsedCookie[key]; + cookies[key] = parsedCookie; + }); + return cookies; + } } RED.nodes.registerType("http request",HTTPRequest,{ diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/io/21-httprequest.html b/packages/node_modules/@node-red/nodes/locales/en-US/io/21-httprequest.html index e981f43b2..aa027da2e 100644 --- a/packages/node_modules/@node-red/nodes/locales/en-US/io/21-httprequest.html +++ b/packages/node_modules/@node-red/nodes/locales/en-US/io/21-httprequest.html @@ -53,6 +53,8 @@ Otherwise, the url of the original request.
responseCookies object
If the response includes cookies, this propery is an object of name/value pairs for each cookie.
+
redirectList array
+
If the request was redirected one or more times, the accumulated information will be added to this property. `location` is the next redirect destination. `cookies` is the cookies returned from the redirect source.

Details

When configured within the node, the URL property can contain mustache-style tags. These allow the diff --git a/packages/node_modules/@node-red/nodes/locales/ja/io/21-httprequest.html b/packages/node_modules/@node-red/nodes/locales/ja/io/21-httprequest.html index 5c98b8be1..d5b072aef 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/io/21-httprequest.html +++ b/packages/node_modules/@node-red/nodes/locales/ja/io/21-httprequest.html @@ -46,6 +46,8 @@

リクエストの処理時にリダイレクトが発生した場合、このプロパティが最後にリダイレクトされたURLを表します。リダイレクトが起こらなかった場合、最初リクエストのURLを表します。
responseCookies オブジェクト
レスポンスがクッキーを含む場合、このプロパティは各クッキーの名前/値を含むオブジェクトを表します。
+
redirectList 配列
+
リクエストが一回以上リダイレクトされた場合は、このプロパティに情報が蓄積されます。`location`は、リダイレクト先を示します。`cookies`は、リダイレクト元から返されたクッキー情報です。

詳細

ノードの設定でurlプロパティを指定する場合、mustache形式のタグを含めることができます。これにより、URLを入力メッセージの値から構成することができます。例えば、urlがexample.com/{{{topic}}}の場合、msg.topicの値による置き換えを自動的に行います。{{{...}}}表記を使うと、/、&といった文字をmustacheがエスケープするのを抑止できます。

diff --git a/test/nodes/core/io/21-httprequest_spec.js b/test/nodes/core/io/21-httprequest_spec.js index a9ac49c99..1490b8363 100644 --- a/test/nodes/core/io/21-httprequest_spec.js +++ b/test/nodes/core/io/21-httprequest_spec.js @@ -207,6 +207,12 @@ describe('HTTP Request Node', function() { res.cookie('redirectToDifferentDomain','different1'); res.redirect(getDifferentTestURL('/redirectReturn')); }); + testApp.get('/redirectMultipleTimes', function(req, res) { + var key = req.headers.host + req.url; + receivedCookies[key] = req.cookies; + res.cookie('redirectMultipleTimes','multiple1'); + res.redirect(getTestURL('/redirectToDifferentDomain')); + }); testApp.get('/redirectReturn', function(req, res) { var key = req.headers.host + req.url; receivedCookies[key] = req.cookies; @@ -277,6 +283,7 @@ describe('HTTP Request Node', function() { msg.should.have.property('headers'); msg.headers.should.have.property('content-length',''+('hello'.length)); msg.headers.should.have.property('content-type').which.startWith('text/html'); + msg.redirectList.length.should.equal(0); done(); } catch(err) { done(err); @@ -1510,6 +1517,10 @@ describe('HTTP Request Node', function() { done(new Error('Invalid cookie(path:/rediectReurn)')); return; } + var redirect1 = msg.redirectList[0]; + redirect1.location.should.equal('http://localhost:'+testPort+'/redirectReturn'); + redirect1.cookies.redirectToSameDomainCookie.Path.should.equals('/'); + redirect1.cookies.redirectToSameDomainCookie.value.should.equals('same1'); done(); }); n1.receive({}); @@ -1533,6 +1544,10 @@ describe('HTTP Request Node', function() { done(new Error('Invalid cookie(path:/rediectReurn)')); return; } + var redirect1 = msg.redirectList[0]; + redirect1.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); + redirect1.cookies.redirectToDifferentDomain.Path.should.equals('/'); + redirect1.cookies.redirectToDifferentDomain.value.should.equals('different1'); done(); }); n1.receive({}); @@ -1559,6 +1574,10 @@ describe('HTTP Request Node', function() { done(new Error('Invalid cookie(path:/rediectReurn)')); return; } + var redirect1 = msg.redirectList[0]; + redirect1.location.should.equal('http://localhost:'+testPort+'/redirectReturn'); + redirect1.cookies.redirectToSameDomainCookie.Path.should.equals('/'); + redirect1.cookies.redirectToSameDomainCookie.value.should.equals('same1'); done(); }); n1.receive({ @@ -1585,6 +1604,10 @@ describe('HTTP Request Node', function() { done(new Error('Invalid cookie(path:/rediectReurn)')); return; } + var redirect1 = msg.redirectList[0]; + redirect1.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); + redirect1.cookies.redirectToDifferentDomain.Path.should.equals('/'); + redirect1.cookies.redirectToDifferentDomain.value.should.equals('different1'); done(); }); n1.receive({ @@ -1613,6 +1636,10 @@ describe('HTTP Request Node', function() { done(new Error('Invalid cookie(path:/rediectReurn)')); return; } + var redirect1 = msg.redirectList[0]; + redirect1.location.should.equal('http://localhost:'+testPort+'/redirectReturn'); + redirect1.cookies.redirectToSameDomainCookie.Path.should.equals('/'); + redirect1.cookies.redirectToSameDomainCookie.value.should.equals('same1'); done(); }); n1.receive({ @@ -1639,6 +1666,33 @@ describe('HTTP Request Node', function() { done(new Error('Invalid cookie(path:/rediectReurn)')); return; } + var redirect1 = msg.redirectList[0]; + redirect1.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); + redirect1.cookies.redirectToDifferentDomain.Path.should.equals('/'); + redirect1.cookies.redirectToDifferentDomain.value.should.equals('different1'); + done(); + }); + n1.receive({ + headers: { cookie: 'requestCookie=request1' } + }); + }); + }); + it('should return all redirect information when redirected multiple times', function(done) { + var flow = [{id:'n1',type:'http request',wires:[['n2']],method:'GET',ret:'obj',url:getTestURL('/redirectMultipleTimes')}, + {id:"n2", type:"helper"}]; + receivedCookies = {}; + helper.load(httpRequestNode, flow, function() { + var n1 = helper.getNode("n1"); + var n2 = helper.getNode("n2"); + n2.on("input", function(msg) { + var redirect1 = msg.redirectList[0]; + redirect1.location.should.equal('http://localhost:'+testPort+'/redirectToDifferentDomain'); + redirect1.cookies.redirectMultipleTimes.Path.should.equals('/'); + redirect1.cookies.redirectMultipleTimes.value.should.equals('multiple1'); + var redirect2 = msg.redirectList[1]; + redirect2.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); + redirect2.cookies.redirectToDifferentDomain.Path.should.equals('/'); + redirect2.cookies.redirectToDifferentDomain.value.should.equals('different1'); done(); }); n1.receive({ From 32d9acdaa5261c6e0aef8407e095206a52e02550 Mon Sep 17 00:00:00 2001 From: nakanishi Date: Tue, 4 Dec 2018 15:46:46 +0000 Subject: [PATCH 03/25] minor fix --- .../@node-red/nodes/core/io/21-httprequest.js | 1 + test/nodes/core/io/21-httprequest_spec.js | 32 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js b/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js index adc1afafe..ea81987a9 100644 --- a/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js +++ b/packages/node_modules/@node-red/nodes/core/io/21-httprequest.js @@ -265,6 +265,7 @@ module.exports = function(RED) { msg.responseUrl = res.request.uri.href; msg.payload = body; msg.redirectList = redirectList; + if (msg.headers.hasOwnProperty('set-cookie')) { msg.responseCookies = extractCookies(msg.headers['set-cookie']); } diff --git a/test/nodes/core/io/21-httprequest_spec.js b/test/nodes/core/io/21-httprequest_spec.js index 1490b8363..1f20b5ca1 100644 --- a/test/nodes/core/io/21-httprequest_spec.js +++ b/test/nodes/core/io/21-httprequest_spec.js @@ -1519,8 +1519,8 @@ describe('HTTP Request Node', function() { } var redirect1 = msg.redirectList[0]; redirect1.location.should.equal('http://localhost:'+testPort+'/redirectReturn'); - redirect1.cookies.redirectToSameDomainCookie.Path.should.equals('/'); - redirect1.cookies.redirectToSameDomainCookie.value.should.equals('same1'); + redirect1.cookies.redirectToSameDomainCookie.Path.should.equal('/'); + redirect1.cookies.redirectToSameDomainCookie.value.should.equal('same1'); done(); }); n1.receive({}); @@ -1546,8 +1546,8 @@ describe('HTTP Request Node', function() { } var redirect1 = msg.redirectList[0]; redirect1.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); - redirect1.cookies.redirectToDifferentDomain.Path.should.equals('/'); - redirect1.cookies.redirectToDifferentDomain.value.should.equals('different1'); + redirect1.cookies.redirectToDifferentDomain.Path.should.equal('/'); + redirect1.cookies.redirectToDifferentDomain.value.should.equal('different1'); done(); }); n1.receive({}); @@ -1576,8 +1576,8 @@ describe('HTTP Request Node', function() { } var redirect1 = msg.redirectList[0]; redirect1.location.should.equal('http://localhost:'+testPort+'/redirectReturn'); - redirect1.cookies.redirectToSameDomainCookie.Path.should.equals('/'); - redirect1.cookies.redirectToSameDomainCookie.value.should.equals('same1'); + redirect1.cookies.redirectToSameDomainCookie.Path.should.equal('/'); + redirect1.cookies.redirectToSameDomainCookie.value.should.equal('same1'); done(); }); n1.receive({ @@ -1606,8 +1606,8 @@ describe('HTTP Request Node', function() { } var redirect1 = msg.redirectList[0]; redirect1.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); - redirect1.cookies.redirectToDifferentDomain.Path.should.equals('/'); - redirect1.cookies.redirectToDifferentDomain.value.should.equals('different1'); + redirect1.cookies.redirectToDifferentDomain.Path.should.equal('/'); + redirect1.cookies.redirectToDifferentDomain.value.should.equal('different1'); done(); }); n1.receive({ @@ -1638,8 +1638,8 @@ describe('HTTP Request Node', function() { } var redirect1 = msg.redirectList[0]; redirect1.location.should.equal('http://localhost:'+testPort+'/redirectReturn'); - redirect1.cookies.redirectToSameDomainCookie.Path.should.equals('/'); - redirect1.cookies.redirectToSameDomainCookie.value.should.equals('same1'); + redirect1.cookies.redirectToSameDomainCookie.Path.should.equal('/'); + redirect1.cookies.redirectToSameDomainCookie.value.should.equal('same1'); done(); }); n1.receive({ @@ -1668,8 +1668,8 @@ describe('HTTP Request Node', function() { } var redirect1 = msg.redirectList[0]; redirect1.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); - redirect1.cookies.redirectToDifferentDomain.Path.should.equals('/'); - redirect1.cookies.redirectToDifferentDomain.value.should.equals('different1'); + redirect1.cookies.redirectToDifferentDomain.Path.should.equal('/'); + redirect1.cookies.redirectToDifferentDomain.value.should.equal('different1'); done(); }); n1.receive({ @@ -1687,12 +1687,12 @@ describe('HTTP Request Node', function() { n2.on("input", function(msg) { var redirect1 = msg.redirectList[0]; redirect1.location.should.equal('http://localhost:'+testPort+'/redirectToDifferentDomain'); - redirect1.cookies.redirectMultipleTimes.Path.should.equals('/'); - redirect1.cookies.redirectMultipleTimes.value.should.equals('multiple1'); + redirect1.cookies.redirectMultipleTimes.Path.should.equal('/'); + redirect1.cookies.redirectMultipleTimes.value.should.equal('multiple1'); var redirect2 = msg.redirectList[1]; redirect2.location.should.equal('http://127.0.0.1:'+testPort+'/redirectReturn'); - redirect2.cookies.redirectToDifferentDomain.Path.should.equals('/'); - redirect2.cookies.redirectToDifferentDomain.value.should.equals('different1'); + redirect2.cookies.redirectToDifferentDomain.Path.should.equal('/'); + redirect2.cookies.redirectToDifferentDomain.value.should.equal('different1'); done(); }); n1.receive({ From ee47646cf73e957245df170b1961149334a20510 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 4 Dec 2018 15:59:43 +0000 Subject: [PATCH 04/25] Fix up unit tests --- .../@node-red/editor-api/lib/index.js | 2 +- .../@node-red/registry/lib/loader.js | 93 +-------------- .../@node-red/registry/lib/util.js | 110 ++++++++++++++++++ .../@node-red/runtime/lib/index.js | 19 ++- packages/node_modules/node-red/lib/red.js | 13 ++- test/nodes/core/core/20-inject_spec.js | 49 ++++---- .../@node-red/editor-api/lib/index_spec.js | 18 +-- test/unit/@node-red/registry/lib/util_spec.js | 20 ++++ test/unit/@node-red/runtime/lib/index_spec.js | 16 ++- test/unit/node-red/lib/red_spec.js | 50 ++++---- 10 files changed, 235 insertions(+), 155 deletions(-) create mode 100644 packages/node_modules/@node-red/registry/lib/util.js create mode 100644 test/unit/@node-red/registry/lib/util_spec.js diff --git a/packages/node_modules/@node-red/editor-api/lib/index.js b/packages/node_modules/@node-red/editor-api/lib/index.js index 3450eaafb..6a7b91944 100644 --- a/packages/node_modules/@node-red/editor-api/lib/index.js +++ b/packages/node_modules/@node-red/editor-api/lib/index.js @@ -100,5 +100,5 @@ module.exports = { auth: { needsPermission: auth.needsPermission }, - get adminApp() { return adminApp; } + get httpAdmin() { return adminApp; } }; diff --git a/packages/node_modules/@node-red/registry/lib/loader.js b/packages/node_modules/@node-red/registry/lib/loader.js index 901a7fba5..ebc814b61 100644 --- a/packages/node_modules/@node-red/registry/lib/loader.js +++ b/packages/node_modules/@node-red/registry/lib/loader.js @@ -21,8 +21,8 @@ var semver = require("semver"); var localfilesystem = require("./localfilesystem"); var registry = require("./registry"); - -var i18n = require("@node-red/util").i18n; // TODO: separate module +var registryUtil = require("./util") +var i18n = require("@node-red/util").i18n; var settings; var runtime; @@ -31,6 +31,7 @@ function init(_runtime) { runtime = _runtime; settings = runtime.settings; localfilesystem.init(runtime); + registryUtil.init(runtime); } function load(defaultNodesDir,disableNodePathScan) { @@ -44,92 +45,6 @@ function load(defaultNodesDir,disableNodePathScan) { return loadNodeFiles(nodeFiles); } -function copyObjectProperties(src,dst,copyList,blockList) { - if (!src) { - return; - } - if (copyList && !blockList) { - copyList.forEach(function(i) { - if (src.hasOwnProperty(i)) { - var propDescriptor = Object.getOwnPropertyDescriptor(src,i); - Object.defineProperty(dst,i,propDescriptor); - } - }); - } else if (!copyList && blockList) { - for (var i in src) { - if (src.hasOwnProperty(i) && blockList.indexOf(i) === -1) { - var propDescriptor = Object.getOwnPropertyDescriptor(src,i); - Object.defineProperty(dst,i,propDescriptor); - } - } - } -} -function requireModule(name) { - var moduleInfo = registry.getModuleInfo(name); - if (moduleInfo && moduleInfo.path) { - var relPath = path.relative(__dirname, moduleInfo.path); - return require(relPath); - } else { - var err = new Error(`Cannot find module '${name}'`); - err.code = "MODULE_NOT_FOUND"; - throw err; - } -} - -function createNodeApi(node) { - var red = { - nodes: {}, - log: {}, - settings: {}, - events: runtime.events, - util: runtime.util, - version: runtime.version, - require: requireModule, - comms: { - publish: function(topic,data,retain) { - runtime.events.emit("comms",{ - topic: topic, - data: data, - retain: retain - }) - } - }, - library: { - register: function(type) { - return runtime.library.register(node.id,type); - } - }, - httpNode: runtime.nodeApp, - server: runtime.server - } - copyObjectProperties(runtime.nodes,red.nodes,["createNode","getNode","eachNode","addCredentials","getCredentials","deleteCredentials" ]); - red.nodes.registerType = function(type,constructor,opts) { - runtime.nodes.registerType(node.id,type,constructor,opts); - } - copyObjectProperties(runtime.log,red.log,null,["init"]); - copyObjectProperties(runtime.settings,red.settings,null,["init","load","reset"]); - if (runtime.adminApi) { - red.auth = runtime.adminApi.auth; - red.httpAdmin = runtime.adminApi.adminApp; - } else { - //TODO: runtime.adminApi is always stubbed if not enabled, so this block - // is unused - but may be needed for the unit tests - red.auth = { - needsPermission: function() {} - }; - // TODO: stub out httpAdmin/httpNode/server - } - red["_"] = function() { - var args = Array.prototype.slice.call(arguments, 0); - if (args[0].indexOf(":") === -1) { - args[0] = node.namespace+":"+args[0]; - } - return i18n._.apply(null,args); - } - return red; -} - - function loadNodeFiles(nodeFiles) { var promises = []; var nodes = []; @@ -332,7 +247,7 @@ function loadNodeSet(node) { var r = require(node.file); if (typeof r === "function") { - var red = createNodeApi(node); + var red = registryUtil.createNodeApi(node); var promise = r(red); if (promise != null && typeof promise.then === "function") { loadPromise = promise.then(function() { diff --git a/packages/node_modules/@node-red/registry/lib/util.js b/packages/node_modules/@node-red/registry/lib/util.js new file mode 100644 index 000000000..c3d50558b --- /dev/null +++ b/packages/node_modules/@node-red/registry/lib/util.js @@ -0,0 +1,110 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +var i18n = require("@node-red/util").i18n; +var runtime; + +function copyObjectProperties(src,dst,copyList,blockList) { + if (!src) { + return; + } + if (copyList && !blockList) { + copyList.forEach(function(i) { + if (src.hasOwnProperty(i)) { + var propDescriptor = Object.getOwnPropertyDescriptor(src,i); + Object.defineProperty(dst,i,propDescriptor); + } + }); + } else if (!copyList && blockList) { + for (var i in src) { + if (src.hasOwnProperty(i) && blockList.indexOf(i) === -1) { + var propDescriptor = Object.getOwnPropertyDescriptor(src,i); + Object.defineProperty(dst,i,propDescriptor); + } + } + } +} +function requireModule(name) { + var moduleInfo = registry.getModuleInfo(name); + if (moduleInfo && moduleInfo.path) { + var relPath = path.relative(__dirname, moduleInfo.path); + return require(relPath); + } else { + var err = new Error(`Cannot find module '${name}'`); + err.code = "MODULE_NOT_FOUND"; + throw err; + } +} + +function createNodeApi(node) { + var red = { + nodes: {}, + log: {}, + settings: {}, + events: runtime.events, + util: runtime.util, + version: runtime.version, + require: requireModule, + comms: { + publish: function(topic,data,retain) { + runtime.events.emit("comms",{ + topic: topic, + data: data, + retain: retain + }) + } + }, + library: { + register: function(type) { + return runtime.library.register(node.id,type); + } + }, + httpNode: runtime.nodeApp, + httpAdmin: runtime.adminApp, + server: runtime.server + } + copyObjectProperties(runtime.nodes,red.nodes,["createNode","getNode","eachNode","addCredentials","getCredentials","deleteCredentials" ]); + red.nodes.registerType = function(type,constructor,opts) { + runtime.nodes.registerType(node.id,type,constructor,opts); + } + copyObjectProperties(runtime.log,red.log,null,["init"]); + copyObjectProperties(runtime.settings,red.settings,null,["init","load","reset"]); + if (runtime.adminApi) { + red.auth = runtime.adminApi.auth; + } else { + //TODO: runtime.adminApi is always stubbed if not enabled, so this block + // is unused - but may be needed for the unit tests + red.auth = { + needsPermission: function(v) { return function(req,res,next) {next()} } + }; + // TODO: stub out httpAdmin/httpNode/server + } + red["_"] = function() { + var args = Array.prototype.slice.call(arguments, 0); + if (args[0].indexOf(":") === -1) { + args[0] = node.namespace+":"+args[0]; + } + return i18n._.apply(null,args); + } + return red; +} + +module.exports = { + init: function(_runtime) { + runtime = _runtime; + }, + createNodeApi: createNodeApi +} diff --git a/packages/node_modules/@node-red/runtime/lib/index.js b/packages/node_modules/@node-red/runtime/lib/index.js index 4cd257f0f..22719f008 100644 --- a/packages/node_modules/@node-red/runtime/lib/index.js +++ b/packages/node_modules/@node-red/runtime/lib/index.js @@ -53,6 +53,7 @@ var adminApi = { } var nodeApp; +var adminApp; var server; @@ -64,12 +65,13 @@ var server; * better abstracted. * @memberof @node-red/runtime */ -function init(userSettings,httpServer,_adminApi) { +function init(userSettings,httpServer,_adminApi,__util) { server = httpServer; userSettings.version = getVersion(); settings.init(userSettings); nodeApp = express(); + adminApp = express(); if (_adminApi) { adminApi = _adminApi; @@ -78,6 +80,13 @@ function init(userSettings,httpServer,_adminApi) { library.init(runtime); externalAPI.init(runtime); exec.init(runtime); + if (__util) { + log = __util.log; + i18n = __util.i18n; + } else { + log = redUtil.log; + i18n = redUtil.i18n; + } } var version; @@ -103,7 +112,6 @@ function getVersion() { * @memberof @node-red/runtime */ function start() { - return i18n.registerMessageCatalog("runtime",path.resolve(path.join(__dirname,"..","locales")),"runtime.json") .then(function() { return storage.init(runtime)}) .then(function() { return settings.load(storage)}) @@ -269,6 +277,7 @@ var runtime = { exec: exec, util: require("@node-red/util").util, get adminApi() { return adminApi }, + get adminApp() { return adminApp }, get nodeApp() { return nodeApp }, get server() { return server }, isStarted: function() { @@ -346,8 +355,12 @@ module.exports = { storage: storage, events: events, + util: require("@node-red/util").util, get httpNode() { return nodeApp }, - get server() { return server } + get httpAdmin() { return adminApp }, + get server() { return server }, + + "_": runtime } diff --git a/packages/node_modules/node-red/lib/red.js b/packages/node_modules/node-red/lib/red.js index 2dcc1ae53..6d052217a 100644 --- a/packages/node_modules/node-red/lib/red.js +++ b/packages/node_modules/node-red/lib/red.js @@ -63,8 +63,13 @@ module.exports = { } redUtil.init(userSettings); if (userSettings.httpAdminRoot !== false) { + // Initialise the runtime runtime.init(userSettings,httpServer,api); + // Initialise the editor-api api.init(userSettings,httpServer,runtime.storage,runtime); + // Attach the runtime admin app to the api admin app + api.httpAdmin.use(runtime.httpAdmin); + apiEnabled = true; server = httpServer; } else { @@ -107,15 +112,17 @@ module.exports = { util: redUtil.util, get nodes() { console.log("Deprecated use of RED.nodes - refer to API documentation on RED.runtime.nodes"); return runtime._.nodes }, - get settings() { console.log("Deprecated use of RED.settings - refer to API documentation on RED.runtime.settings"); return runtime._.settings }, - get version() { console.log("Deprecated use of RED.version - refer to API documentation on RED.runtime.version"); return runtime._.version }, get events() { console.log("Deprecated use of RED.events - refer to API documentation on RED.runtime.events"); return runtime.events }, + get settings() { return runtime._.settings }, + get version() { return runtime._.version }, + + /** * The express application for the Editor Admin API * @memberof node-red */ - get httpAdmin() { return api.adminApp }, + get httpAdmin() { return api.httpAdmin }, /** * The express application for HTTP Nodes diff --git a/test/nodes/core/core/20-inject_spec.js b/test/nodes/core/core/20-inject_spec.js index fa398ee23..8eeec3620 100644 --- a/test/nodes/core/core/20-inject_spec.js +++ b/test/nodes/core/core/20-inject_spec.js @@ -52,30 +52,30 @@ describe('inject node', function() { }); function basicTest(type, val, rval) { - it('inject value ('+type+')', function (done) { + it('inject value ('+type+')', function (done) { var flow = [{id: "n1", type: "inject", topic: "t1", payload: val, payloadType: type, wires: [["n2"]], z: "flow"}, - {id: "n2", type: "helper"}]; + {id: "n2", type: "helper"}]; helper.load(injectNode, flow, function () { - var n1 = helper.getNode("n1"); - var n2 = helper.getNode("n2"); - n2.on("input", function (msg) { + var n1 = helper.getNode("n1"); + var n2 = helper.getNode("n2"); + n2.on("input", function (msg) { try { - msg.should.have.property("topic", "t1"); - if (rval) { - msg.should.have.property("payload"); - should.deepEqual(msg.payload, rval); - } - else { - msg.should.have.property("payload", val); - } - done(); + msg.should.have.property("topic", "t1"); + if (rval) { + msg.should.have.property("payload"); + should.deepEqual(msg.payload, rval); + } + else { + msg.should.have.property("payload", val); + } + done(); } catch (err) { - done(err); + done(err); } - }); - n1.receive({}); + }); + n1.receive({}); }); - }); + }); } basicTest("num", 10); @@ -503,16 +503,21 @@ describe('inject node', function() { done(); }); }); - helper.request() + try { + helper.request() .post('/inject/n1') .expect(200).end(function(err) { if (err) { + console.log(err); return helper.clearFlows() - .then(function () { - done(err); - }); + .then(function () { + done(err); + }); } }); + } catch(err) { + done(err); + } }); }); diff --git a/test/unit/@node-red/editor-api/lib/index_spec.js b/test/unit/@node-red/editor-api/lib/index_spec.js index 751457b20..1d5e9380b 100644 --- a/test/unit/@node-red/editor-api/lib/index_spec.js +++ b/test/unit/@node-red/editor-api/lib/index_spec.js @@ -59,8 +59,8 @@ describe("api/index", function() { afterEach(afterEach); it("does not setup admin api if httpAdminRoot is false", function(done) { - api.init({},{ httpAdminRoot: false },{},{}); - should.not.exist(api.adminApp); + api.init({ httpAdminRoot: false },{},{},{}); + should.not.exist(api.httpAdmin); done(); }); describe('initalises admin api without adminAuth', function(done) { @@ -70,30 +70,30 @@ describe("api/index", function() { }); after(afterEach); it('exposes the editor',function(done) { - request(api.adminApp).get("/editor").expect(200).end(done); + request(api.httpAdmin).get("/editor").expect(200).end(done); }) it('exposes the admin api',function(done) { - request(api.adminApp).get("/admin").expect(200).end(done); + request(api.httpAdmin).get("/admin").expect(200).end(done); }) it('exposes the auth api',function(done) { - request(api.adminApp).get("/auth/login").expect(200).end(done); + request(api.httpAdmin).get("/auth/login").expect(200).end(done); }) }); describe('initalises admin api without editor', function(done) { before(function() { beforeEach(); - api.init({},{ disableEditor: true },{},{}); + api.init({ disableEditor: true },{},{},{}); }); after(afterEach); it('does not expose the editor',function(done) { - request(api.adminApp).get("/editor").expect(404).end(done); + request(api.httpAdmin).get("/editor").expect(404).end(done); }) it('exposes the admin api',function(done) { - request(api.adminApp).get("/admin").expect(200).end(done); + request(api.httpAdmin).get("/admin").expect(200).end(done); }) it('exposes the auth api',function(done) { - request(api.adminApp).get("/auth/login").expect(200).end(done) + request(api.httpAdmin).get("/auth/login").expect(200).end(done) }) }); }); diff --git a/test/unit/@node-red/registry/lib/util_spec.js b/test/unit/@node-red/registry/lib/util_spec.js new file mode 100644 index 000000000..a82519d11 --- /dev/null +++ b/test/unit/@node-red/registry/lib/util_spec.js @@ -0,0 +1,20 @@ +/** + * Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + + +describe("red/nodes/registry/util",function() { + it.skip("NEEDS TESTS"); +}); diff --git a/test/unit/@node-red/runtime/lib/index_spec.js b/test/unit/@node-red/runtime/lib/index_spec.js index 3fa0a151e..f6a506de1 100644 --- a/test/unit/@node-red/runtime/lib/index_spec.js +++ b/test/unit/@node-red/runtime/lib/index_spec.js @@ -25,6 +25,8 @@ var runtime = NR_TEST_UTILS.require("@node-red/runtime"); var redNodes = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes"); var storage = NR_TEST_UTILS.require("@node-red/runtime/lib/storage"); var settings = NR_TEST_UTILS.require("@node-red/runtime/lib/settings"); +var util = NR_TEST_UTILS.require("@node-red/util"); + var log = NR_TEST_UTILS.require("@node-red/util").log; describe("runtime", function() { @@ -41,6 +43,7 @@ describe("runtime", function() { delete process.env.NODE_RED_HOME; }); function mockUtil(metrics) { + return { log:{ log: sinon.stub(), @@ -95,6 +98,7 @@ describe("runtime", function() { var redNodesLoadFlows; var redNodesStartFlows; var redNodesLoadContextsPlugin; + var i18nRegisterMessageCatalog; beforeEach(function() { storageInit = sinon.stub(storage,"init",function(settings) {return Promise.resolve();}); @@ -104,6 +108,7 @@ describe("runtime", function() { redNodesLoadFlows = sinon.stub(redNodes,"loadFlows",function() {return Promise.resolve()}); redNodesStartFlows = sinon.stub(redNodes,"startFlows",function() {}); redNodesLoadContextsPlugin = sinon.stub(redNodes,"loadContextsPlugin",function() {return Promise.resolve()}); + i18nRegisterMessageCatalog = sinon.stub(util.i18n,"registerMessageCatalog",function() {return Promise.resolve()}); }); afterEach(function() { storageInit.restore(); @@ -114,6 +119,7 @@ describe("runtime", function() { redNodesLoadFlows.restore(); redNodesStartFlows.restore(); redNodesLoadContextsPlugin.restore(); + i18nRegisterMessageCatalog.restore(); }); it("reports errored/missing modules",function(done) { redNodesGetNodeList = sinon.stub(redNodes,"getNodeList", function(cb) { @@ -199,10 +205,14 @@ describe("runtime", function() { var stopFlows = sinon.stub(redNodes,"stopFlows",function() { return Promise.resolve();} ); redNodesGetNodeList = sinon.stub(redNodes,"getNodeList", function() {return []}); var util = mockUtil(true); - runtime.init({testSettings: true, runtimeMetricInterval:200, httpAdminRoot:"/", load:function() { return Promise.resolve();}},util); - sinon.stub(console,"log"); + runtime.init( + {testSettings: true, runtimeMetricInterval:200, httpAdminRoot:"/", load:function() { return Promise.resolve();}}, + {}, + undefined, + util); + // sinon.stub(console,"log"); runtime.start().then(function() { - console.log.restore(); + // console.log.restore(); setTimeout(function() { try { util.log.log.args.should.have.lengthOf(3); diff --git a/test/unit/node-red/lib/red_spec.js b/test/unit/node-red/lib/red_spec.js index e1950f407..e5d986f82 100644 --- a/test/unit/node-red/lib/red_spec.js +++ b/test/unit/node-red/lib/red_spec.js @@ -31,31 +31,31 @@ var api = NR_TEST_UTILS.require("@node-red/runtime/lib/api"); describe("red/red", function() { - describe("check build", function() { - beforeEach(function() { - sinon.stub(runtime,"init",function() {}); - sinon.stub(api,"init",function() {}); - sinon.stub(RED,"version",function() { return "version";}); - }); - afterEach(function() { - runtime.init.restore(); - api.init.restore(); - fs.statSync.restore(); - RED.version.restore(); - }); - it.skip('warns if build has not been run',function() { - sinon.stub(fs,"statSync",function() { throw new Error();}); - - /*jshint immed: false */ - (function() { - RED.init({},{}); - }).should.throw("Node-RED not built"); - }); - it('passed if build has been run',function() { - sinon.stub(fs,"statSync",function() { }); - RED.init({},{}); - }); - }); + // describe("check build", function() { + // beforeEach(function() { + // sinon.stub(runtime,"init",function() {}); + // sinon.stub(api,"init",function() {}); + // // sinon.stub(RED,"version",function() { return "version";}); + // }); + // afterEach(function() { + // runtime.init.restore(); + // api.init.restore(); + // fs.statSync.restore(); + // // RED.version.restore(); + // }); + // it.skip('warns if build has not been run',function() { + // sinon.stub(fs,"statSync",function() { throw new Error();}); + // + // /*jshint immed: false */ + // (function() { + // RED.init({},{}); + // }).should.throw("Node-RED not built"); + // }); + // it('passed if build has been run',function() { + // sinon.stub(fs,"statSync",function() { }); + // RED.init({},{}); + // }); + // }); describe("externals", function() { it('reports version', function() { From 8e1c15419cd8aca1d57b08393dcb005a1008aae2 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 5 Dec 2018 13:00:25 +0000 Subject: [PATCH 05/25] API documentation updates --- Gruntfile.js | 18 ++++---- .../@node-red/runtime/lib/events.js | 30 ++++++++++++-- packages/node_modules/@node-red/util/index.js | 20 +++++---- .../node_modules/@node-red/util/lib/i18n.js | 16 ++++---- .../node_modules/@node-red/util/lib/log.js | 34 +++++++++------ .../node_modules/@node-red/util/lib/util.js | 41 +++++++++---------- packages/node_modules/node-red/lib/red.js | 27 +++++++++++- 7 files changed, 124 insertions(+), 62 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ee49ae9eb..eae2587ef 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -429,23 +429,18 @@ module.exports = function(grunt) { } }, jsdoc : { - runtimeAPI: { + modules: { src: [ 'packages/node_modules/node-red/lib/red.js', 'packages/node_modules/@node-red/runtime/lib/index.js', 'packages/node_modules/@node-red/runtime/lib/api/*.js', + 'packages/node_modules/@node-red/runtime/lib/events.js', + 'packages/node_modules/@node-red/util/**/*.js', ], options: { destination: 'docs', configure: './jsdoc.json' } - }, - nodeREDUtil: { - src: 'packages/node_modules/@node-red/util/**/*.js', - options: { - destination: 'packages/node_modules/@node-red/util/docs', - configure: './jsdoc.json' - } } }, jsdoc2md: { @@ -453,8 +448,11 @@ module.exports = function(grunt) { options: { separators: true }, - src: ['packages/node_modules/@node-red/runtime/lib/index.js', - 'packages/node_modules/@node-red/runtime/lib/api/*.js'], + src: [ + 'packages/node_modules/@node-red/runtime/lib/index.js', + 'packages/node_modules/@node-red/runtime/lib/api/*.js', + 'packages/node_modules/@node-red/runtime/lib/events.js' + ], dest: 'packages/node_modules/@node-red/runtime/docs/api.md' }, nodeREDUtil: { diff --git a/packages/node_modules/@node-red/runtime/lib/events.js b/packages/node_modules/@node-red/runtime/lib/events.js index d1f2bc820..ed280a618 100644 --- a/packages/node_modules/@node-red/runtime/lib/events.js +++ b/packages/node_modules/@node-red/runtime/lib/events.js @@ -1,4 +1,4 @@ -/** +/*! * Copyright JS Foundation and other contributors, http://js.foundation * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +14,30 @@ * limitations under the License. **/ -var events = require("events"); +var events = require("events"); -module.exports = new events.EventEmitter(); +module.exports = new events.EventEmitter(); + +/** + * Runtime events emitter + * @mixin @node-red/runtime_events + */ + +/** + * Register an event listener for a runtime event + * @name on + * @function + * @memberof @node-red/runtime_events + * @param {String} eventName - the name of the event to listen to + * @param {Function} listener - the callback function for the event + */ + + /** + * Emit an event to all of its registered listeners + * @name emit + * @function + * @memberof @node-red/runtime_events + * @param {String} eventName - the name of the event to emit + * @param {any} ...args - the arguments to pass in the event + * @return {Boolean} - whether the event had listeners or not + */ diff --git a/packages/node_modules/@node-red/util/index.js b/packages/node_modules/@node-red/util/index.js index cc7f502f8..66ac91bd3 100644 --- a/packages/node_modules/@node-red/util/index.js +++ b/packages/node_modules/@node-red/util/index.js @@ -1,4 +1,4 @@ -/** +/*! * Copyright JS Foundation and other contributors, http://js.foundation * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,17 +14,20 @@ * limitations under the License. **/ - /** - * @module @node-red/util - */ const log = require("./lib/log"); const i18n = require("./lib/i18n"); const util = require("./lib/util"); +/** + * This module provides common utilities for the Node-RED runtime and editor + * + * @namespace @node-red/util + */ module.exports = { /** * Initialise the module with the runtime settings * @param {Object} settings + * @memberof @node-red/util */ init: function(settings) { log.init(settings); @@ -33,19 +36,22 @@ module.exports = { /** * Logging utilities - * @see module:@node-red/util.module:log + * @mixes @node-red/util_log + * @memberof @node-red/util */ log: log, /** * Internationalization utilities - * @see module:@node-red/util.module:i18n + * @mixes @node-red/util_i18n + * @memberof @node-red/util */ i18n: i18n, /** * General utilities - * @see module:@node-red/util.module:util + * @mixes @node-red/util_util + * @memberof @node-red/util */ util: util, } diff --git a/packages/node_modules/@node-red/util/lib/i18n.js b/packages/node_modules/@node-red/util/lib/i18n.js index 07f534dff..6dc707237 100644 --- a/packages/node_modules/@node-red/util/lib/i18n.js +++ b/packages/node_modules/@node-red/util/lib/i18n.js @@ -15,10 +15,10 @@ * @ignore **/ - /** - * @module i18n - * @memberof module:@node-red/util - */ +/** + * Internationalization utilities + * @mixin @node-red/util_i18n + */ var i18n = require("i18next"); @@ -34,7 +34,7 @@ var initPromise; /** * Register multiple message catalogs with i18n. - * @memberof module:@node-red/util.module:i18n + * @memberof @node-red/util_i18n */ function registerMessageCatalogs(catalogs) { var promises = catalogs.map(function(catalog) { @@ -45,7 +45,7 @@ function registerMessageCatalogs(catalogs) { /** * Register a message catalog with i18n. - * @memberof module:@node-red/util.module:i18n + * @memberof @node-red/util_i18n */ function registerMessageCatalog(namespace,dir,file) { return initPromise.then(function() { @@ -146,7 +146,7 @@ function init() { * Gets a message catalog. * @name catalog * @function - * @memberof module:@node-red/util.module:i18n + * @memberof @node-red/util_i18n */ function getCatalog(namespace,lang) { var result = null; @@ -182,7 +182,7 @@ var obj = module.exports = { * Perform a message catalog lookup. * @name _ * @function - * @memberof module:@node-red/util.module:i18n + * @memberof @node-red/util_i18n */ obj['_'] = function() { //var opts = {}; diff --git a/packages/node_modules/@node-red/util/lib/log.js b/packages/node_modules/@node-red/util/lib/log.js index 8c52e3ed9..abce5fa99 100644 --- a/packages/node_modules/@node-red/util/lib/log.js +++ b/packages/node_modules/@node-red/util/lib/log.js @@ -16,8 +16,8 @@ **/ /** - * @module log - * @memberof module:@node-red/util + * Logging utilities + * @mixin @node-red/util_log */ var util = require("util"); @@ -128,14 +128,16 @@ var log = module.exports = { }, /** - * Add a log handler function. + * Add a log handler function + * @memberof @node-red/util_log */ addHandler: function(func) { logHandlers.push(func); }, /** - * Remove a log handler function. + * Remove a log handler function + * @memberof @node-red/util_log */ removeHandler: function(func) { var index = logHandlers.indexOf(func); @@ -145,7 +147,8 @@ var log = module.exports = { }, /** - * Log a message object. + * Log a message object + * @memberof @node-red/util_log */ log: function(msg) { msg.timestamp = Date.now(); @@ -155,42 +158,48 @@ var log = module.exports = { }, /** - * Log a message at INFO level. + * Log a message at INFO level + * @memberof @node-red/util_log */ info: function(msg) { log.log({level:log.INFO,msg:msg}); }, /** - * Log a message at WARN level. + * Log a message at WARN level + * @memberof @node-red/util_log */ warn: function(msg) { log.log({level:log.WARN,msg:msg}); }, /** - * Log a message at ERROR level. + * Log a message at ERROR level + * @memberof @node-red/util_log */ error: function(msg) { log.log({level:log.ERROR,msg:msg}); }, /** - * Log a message at TRACE level. + * Log a message at TRACE level + * @memberof @node-red/util_log */ trace: function(msg) { log.log({level:log.TRACE,msg:msg}); }, /** - * Log a message at DEBUG level. + * Log a message at DEBUG level + * @memberof @node-red/util_log */ debug: function(msg) { log.log({level:log.DEBUG,msg:msg}); }, /** - * Log a metric event. + * Check if metrics are enabled + * @memberof @node-red/util_log */ metric: function() { return metricsEnabled; @@ -198,6 +207,7 @@ var log = module.exports = { /** * Log an audit event. + * @memberof @node-red/util_log */ audit: function(msg,req) { msg.level = log.AUDIT; @@ -214,6 +224,6 @@ var log = module.exports = { * Perform a message catalog lookup. * @name _ * @function - * @memberof module:@node-red/util.module:log + * @memberof @node-red/util_log */ log["_"] = i18n._; diff --git a/packages/node_modules/@node-red/util/lib/util.js b/packages/node_modules/@node-red/util/lib/util.js index 9c9c344d9..8aec3b9f1 100644 --- a/packages/node_modules/@node-red/util/lib/util.js +++ b/packages/node_modules/@node-red/util/lib/util.js @@ -15,10 +15,9 @@ * @ignore **/ - /** - * @module util - * @memberof module:@node-red/util - */ +/** + * @mixin @node-red/util_util + */ const clone = require("clone"); @@ -29,7 +28,7 @@ const util = require("util"); /** * Generates a psuedo-unique-random id. * @return {String} a random-ish id - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function generateId() { return (1+Math.random()*4294967295).toString(16); @@ -41,7 +40,7 @@ function generateId() { * * @param {any} o - the property to convert to a String * @return {String} the stringified version - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function ensureString(o) { if (Buffer.isBuffer(o)) { @@ -60,7 +59,7 @@ function ensureString(o) { * * @param {any} o - the property to convert to a Buffer * @return {String} the Buffer version - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function ensureBuffer(o) { if (Buffer.isBuffer(o)) { @@ -79,7 +78,7 @@ function ensureBuffer(o) { * * @param {any} msg - the message object to clone * @return {Object} the cloned message - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function cloneMessage(msg) { // Temporary fix for #97 @@ -106,7 +105,7 @@ function cloneMessage(msg) { * @param {any} obj1 * @param {any} obj2 * @return {boolean} whether the two objects are the same - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function compareObjects(obj1,obj2) { var i; @@ -189,7 +188,7 @@ function createError(code, message) { * * @param {String} str - the property expression * @return {Array} the normalised expression - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function normalisePropertyExpression(str) { // This must be kept in sync with validatePropertyExpression @@ -304,7 +303,7 @@ function normalisePropertyExpression(str) { * @param {Object} msg - the message object * @param {String} str - the property expression * @return {any} the message property, or undefined if it does not exist - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function getMessageProperty(msg,expr) { if (expr.indexOf('msg.')===0) { @@ -319,7 +318,7 @@ function getMessageProperty(msg,expr) { * @param {Object} msg - the object * @param {String} str - the property expression * @return {any} the object property, or undefined if it does not exist - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function getObjectProperty(msg,expr) { var result = null; @@ -342,7 +341,7 @@ function getObjectProperty(msg,expr) { * @param {String} prop - the property expression * @param {any} value - the value to set * @param {boolean} createMissing - whether to create missing parent properties - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function setMessageProperty(msg,prop,value,createMissing) { if (prop.indexOf('msg.')===0) { @@ -358,7 +357,7 @@ function setMessageProperty(msg,prop,value,createMissing) { * @param {String} prop - the property expression * @param {any} value - the value to set * @param {boolean} createMissing - whether to create missing parent properties - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function setObjectProperty(msg,prop,value,createMissing) { if (typeof createMissing === 'undefined') { @@ -422,7 +421,7 @@ function setObjectProperty(msg,prop,value,createMissing) { * will return `Hello Joe!`. * @param {String} value - the string to parse * @return {String} The parsed string -* @memberof module:@node-red/util.module:util +* @memberof @node-red/util_util */ function evaluateEnvProperty(value) { if (/^\${[^}]+}$/.test(value)) { @@ -450,7 +449,7 @@ function evaluateEnvProperty(value) { * * @param {String} value - the context property string to parse * @return {Object} The parsed property - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function parseContextStore(key) { var parts = {}; @@ -474,7 +473,7 @@ function parseContextStore(key) { * @param {Object} msg - the message object to evaluate against * @param {Function} callback - (optional) called when the property is evaluated * @return {any} The evaluted property, if no `callback` is provided - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function evaluateNodeProperty(value, type, node, msg, callback) { var result = value; @@ -531,7 +530,7 @@ function evaluateNodeProperty(value, type, node, msg, callback) { * @param {String} value - the JSONata expression * @param {Node} node - the node evaluating the property * @return {Object} The JSONata expression that can be evaluated - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function prepareJSONataExpression(value,node) { var expr = jsonata(value); @@ -559,7 +558,7 @@ function prepareJSONataExpression(value,node) { * @param {Object} msg - the message object to evaluate against * @param {Function} callback - (optional) called when the expression is evaluated * @return {any} If no callback was provided, the result of the expression - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function evaluateJSONataExpression(expr,msg,callback) { var context = msg; @@ -604,7 +603,7 @@ function evaluateJSONataExpression(expr,msg,callback) { * * @param {String} name - the node type * @return {String} The normalised name - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function normaliseNodeTypeName(name) { var result = name.replace(/[^a-zA-Z0-9]/g, " "); @@ -628,7 +627,7 @@ function normaliseNodeTypeName(name) { * @param {Object} msg * @param {Object} opts * @return {Object} the encoded object - * @memberof module:@node-red/util.module:util + * @memberof @node-red/util_util */ function encodeObject(msg,opts) { var debuglength = 1000; diff --git a/packages/node_modules/node-red/lib/red.js b/packages/node_modules/node-red/lib/red.js index 6d052217a..1f8b8dd11 100644 --- a/packages/node_modules/node-red/lib/red.js +++ b/packages/node_modules/node-red/lib/red.js @@ -108,13 +108,38 @@ module.exports = { }) }, + /** + * Logging utilities + * @see @node-red/util_log + * @memberof node-red + */ log: redUtil.log, + + /** + * General utilities + * @see @node-red/util_util + * @memberof node-red + */ util: redUtil.util, get nodes() { console.log("Deprecated use of RED.nodes - refer to API documentation on RED.runtime.nodes"); return runtime._.nodes }, - get events() { console.log("Deprecated use of RED.events - refer to API documentation on RED.runtime.events"); return runtime.events }, + + /** + * Runtime events emitter + * @see @node-red/runtime_events + * @memberof node-red + */ + events: runtime.events, get settings() { return runtime._.settings }, + + + /** + * Get the version of the runtime + * @return {String} - the runtime version + * @function + * @memberof node-red + */ get version() { return runtime._.version }, From abe746020b0a3ab0559ca8a448ee9b1df676b4b8 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 5 Dec 2018 13:48:39 +0000 Subject: [PATCH 06/25] Update packages/node_modules/@node-red/runtime/locales/en-US/runtime.json Co-Authored-By: dceejay --- .../node_modules/@node-red/runtime/locales/en-US/runtime.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json index 9fbf5f029..d56031d2f 100644 --- a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json +++ b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json @@ -14,7 +14,7 @@ "palette-editor": { "disabled": "Palette editor disabled : user settings", "npm-not-found": "Palette editor disabled : npm command not found", - "npm-too-old": "Palette editor disabled : npm version too old - please update" + "npm-too-old": "Palette editor disabled : npm version too old. Requires npm >= 3.x" }, "errors": "Failed to register __count__ node type", "errors_plural": "Failed to register __count__ node types", From 96e3aab3b4f0fd83ff3c7adcd686630a2b8f9529 Mon Sep 17 00:00:00 2001 From: meeki007 Date: Sun, 11 Nov 2018 13:44:25 -0500 Subject: [PATCH 07/25] update 10-switch.html - missing Font Awesome font switch node was missing font ( fa-ellipsis-h ) other nodes that have been updated with property option have the icon. rbe-node and range-node have the icon to the left of property its time the switch-node joins its siblings in uniformity. --- packages/node_modules/@node-red/nodes/core/logic/10-switch.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/nodes/core/logic/10-switch.html b/packages/node_modules/@node-red/nodes/core/logic/10-switch.html index fddb40307..65e83ca09 100644 --- a/packages/node_modules/@node-red/nodes/core/logic/10-switch.html +++ b/packages/node_modules/@node-red/nodes/core/logic/10-switch.html @@ -20,7 +20,7 @@
- +
From 86716b5ffb1e08e0c6bd196a9b60f342083127b5 Mon Sep 17 00:00:00 2001 From: meeki007 Date: Wed, 5 Dec 2018 14:47:38 +0000 Subject: [PATCH 08/25] Tidy up Template node edit form Closes #1969 #1970 #1968 #1967 --- .../node_modules/@node-red/nodes/core/core/80-template.html | 2 +- .../node_modules/@node-red/nodes/locales/en-US/messages.json | 2 +- packages/node_modules/@node-red/nodes/locales/ja/messages.json | 2 +- .../node_modules/@node-red/nodes/locales/zh-CN/messages.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/core/80-template.html b/packages/node_modules/@node-red/nodes/core/core/80-template.html index 764a057e9..88e8b278f 100644 --- a/packages/node_modules/@node-red/nodes/core/core/80-template.html +++ b/packages/node_modules/@node-red/nodes/core/core/80-template.html @@ -5,7 +5,7 @@
- +
diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json index a6c6e1da2..6e71d8a10 100644 --- a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json @@ -203,7 +203,7 @@ "template": "template", "label": { "template": "Template", - "property": "Set property", + "property": "Property", "format": "Syntax Highlight", "syntax": "Format", "output": "Output as", diff --git a/packages/node_modules/@node-red/nodes/locales/ja/messages.json b/packages/node_modules/@node-red/nodes/locales/ja/messages.json index df3974aac..4aad7bf0d 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/ja/messages.json @@ -203,7 +203,7 @@ "template": "template", "label": { "template": "テンプレート", - "property": "設定先", + "property": "プロパティ", "format": "構文", "syntax": "形式", "output": "出力形式", diff --git a/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json b/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json index d2ca5674f..cc5a4cf64 100644 --- a/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json @@ -196,7 +196,7 @@ "template": { "label": { "template": "模版", - "property": "设定属性", + "property": "属性", "format": "语法高亮", "syntax": "格式", "output": "输出为", From 09cd710f663a457e7911d829e6f94c4ce9e69e7b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 6 Dec 2018 10:51:56 +0000 Subject: [PATCH 09/25] Add RED.notifications.hide flag For use by the UI tests to suppress notifications from being displayed in the editor. It is not for use by end-users and not exposed in any way other than via javascript injection by the UI tests --- .../editor-client/src/js/ui/notifications.js | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js b/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js index e232af282..af7fd31b4 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js @@ -16,6 +16,10 @@ RED.notifications = (function() { /* + If RED.notifications.hide is set to true, all notifications will be hidden. + This is to help with UI testing in certain cases and not intended for the + end-user. + // Example usage for a modal dialog with buttons var myNotification = RED.notify("This is the message to display",{ modal: true, @@ -108,7 +112,9 @@ RED.notifications = (function() { $("#notifications").append(n); - $(n).slideDown(300); + if (!RED.notifications.hide) { + $(n).slideDown(300); + } n.close = (function() { var nn = n; return function() { @@ -123,9 +129,13 @@ RED.notifications = (function() { notificationButtonWrapper.hide(); } } - $(nn).slideUp(300, function() { + if (!RED.notifications.hide) { + $(nn).slideUp(300, function() { + nn.parentNode.removeChild(nn); + }); + } else { nn.parentNode.removeChild(nn); - }); + } if (options.modal) { $("#full-shade").hide(); } @@ -138,7 +148,9 @@ RED.notifications = (function() { return } nn.hidden = true; - $(nn).slideUp(300); + if (!RED.notifications.hide) { + $(nn).slideUp(300); + } } })(); n.showNotification = (function() { @@ -148,7 +160,9 @@ RED.notifications = (function() { return } nn.hidden = false; - $(nn).slideDown(300); + if (!RED.notifications.hide) { + $(nn).slideDown(300); + } } })(); From c76bd39280b0faba1b66a70dc6aee78fd7b734e2 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 6 Dec 2018 10:54:23 +0000 Subject: [PATCH 10/25] Improve alignment of node label edit inputs --- .../node_modules/@node-red/editor-client/src/js/ui/editor.js | 4 ++-- .../node_modules/@node-red/editor-client/src/sass/editor.scss | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js index 782b9aeac..e261fefd4 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js @@ -865,7 +865,7 @@ RED.editor = (function() { var inputPlaceholder = node._def.inputLabels?RED._("editor.defaultLabel"):RED._("editor.noDefaultLabel"); var outputPlaceholder = node._def.outputLabels?RED._("editor.defaultLabel"):RED._("editor.noDefaultLabel"); - $('
').appendTo(dialogForm); + $('
').appendTo(dialogForm); var inputsDiv = $("#node-label-form-inputs"); if (inputCount > 0) { for (i=0;i
').appendTo(dialogForm); + $('
').appendTo(dialogForm); var outputsDiv = $("#node-label-form-outputs"); if (outputCount > 0) { for (i=0;i Date: Thu, 6 Dec 2018 10:54:42 +0000 Subject: [PATCH 11/25] Fix Template node name field from overflowing row --- .../node_modules/@node-red/nodes/core/core/80-template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/nodes/core/core/80-template.html b/packages/node_modules/@node-red/nodes/core/core/80-template.html index 88e8b278f..9dabf117b 100644 --- a/packages/node_modules/@node-red/nodes/core/core/80-template.html +++ b/packages/node_modules/@node-red/nodes/core/core/80-template.html @@ -2,7 +2,7 @@ - - diff --git a/packages/node_modules/@node-red/nodes/core/analysis/72-sentiment.js b/packages/node_modules/@node-red/nodes/core/analysis/72-sentiment.js deleted file mode 100644 index ff0cf33e8..000000000 --- a/packages/node_modules/@node-red/nodes/core/analysis/72-sentiment.js +++ /dev/null @@ -1,23 +0,0 @@ - -module.exports = function(RED) { - "use strict"; - var sentiment = require('sentiment'); - - function SentimentNode(n) { - RED.nodes.createNode(this,n); - this.property = n.property||"payload"; - var node = this; - - this.on("input", function(msg) { - var value = RED.util.getMessageProperty(msg,node.property); - if (value !== undefined) { - sentiment(value, msg.overrides || null, function (err, result) { - msg.sentiment = result; - node.send(msg); - }); - } - else { node.send(msg); } // If no matching property - just pass it on. - }); - } - RED.nodes.registerType("sentiment",SentimentNode); -} diff --git a/packages/node_modules/@node-red/nodes/core/storage/28-tail.html b/packages/node_modules/@node-red/nodes/core/storage/28-tail.html deleted file mode 100644 index 2386dec0f..000000000 --- a/packages/node_modules/@node-red/nodes/core/storage/28-tail.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - diff --git a/packages/node_modules/@node-red/nodes/core/storage/28-tail.js b/packages/node_modules/@node-red/nodes/core/storage/28-tail.js deleted file mode 100644 index 801169955..000000000 --- a/packages/node_modules/@node-red/nodes/core/storage/28-tail.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -module.exports = function(RED) { - "use strict"; - var spawn = require('child_process').spawn; - var plat = require('os').platform(); - - if (plat.match(/^win/)) { - throw RED._("tail.errors.windowsnotsupport"); - } - - function TailNode(n) { - RED.nodes.createNode(this,n); - - this.filename = n.filename; - this.filetype = n.filetype || "text"; - this.split = n.split || false; - var node = this; - - var err = ""; - // TODO: rewrite to use node-tail - var tail = spawn("tail", ["-F", "-n", "0", this.filename]); - tail.stdout.on("data", function (data) { - var msg = { topic:node.filename }; - if (node.filetype === "text") { - if (node.split) { - // TODO: allow customisation of the line break - as we do elsewhere - var strings = data.toString().split("\n"); - for (var s in strings) { - //TODO: should we really filter blanks? Is that expected? - if (strings[s] !== "") { - node.send({ - topic: node.filename, - payload: strings[s] - }); - } - } - } - else { - msg.payload = data.toString(); - node.send(msg); - } - } - else { - msg.payload = data; - node.send(msg); - } - }); - - tail.stderr.on("data", function(data) { - node.error(data.toString()); - }); - - this.on("close", function() { - /* istanbul ignore else */ - if (tail) { tail.kill(); } - }); - } - - RED.nodes.registerType("tail",TailNode); -} diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/analysis/72-sentiment.html b/packages/node_modules/@node-red/nodes/locales/en-US/analysis/72-sentiment.html deleted file mode 100644 index 66efa6a87..000000000 --- a/packages/node_modules/@node-red/nodes/locales/en-US/analysis/72-sentiment.html +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json index 6e71d8a10..006cd5799 100644 --- a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json @@ -824,21 +824,6 @@ "pythoncommandnotfound": "nrpgio python command not running" } }, - "tail": { - "tail": "tail", - "label": { - "filename": "Filename", - "type": "File type", - "splitlines": "Split lines on \\n?" - }, - "action": { - "text": "Text - returns String", - "binary": "Binary - returns Buffer" - }, - "errors": { - "windowsnotsupport": "Not currently supported on Windows." - } - }, "file": { "label": { "filename": "Filename", diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/storage/28-tail.html b/packages/node_modules/@node-red/nodes/locales/en-US/storage/28-tail.html deleted file mode 100644 index 36c1fcb15..000000000 --- a/packages/node_modules/@node-red/nodes/locales/en-US/storage/28-tail.html +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/packages/node_modules/@node-red/nodes/locales/ja/analysis/72-sentiment.html b/packages/node_modules/@node-red/nodes/locales/ja/analysis/72-sentiment.html deleted file mode 100644 index 413e87893..000000000 --- a/packages/node_modules/@node-red/nodes/locales/ja/analysis/72-sentiment.html +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/packages/node_modules/@node-red/nodes/locales/ja/messages.json b/packages/node_modules/@node-red/nodes/locales/ja/messages.json index 4aad7bf0d..61fa0b603 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/ja/messages.json @@ -822,21 +822,6 @@ "pythoncommandnotfound": "nrpgio python コマンドが実行されていません" } }, - "tail": { - "tail": "tail", - "label": { - "filename": "ファイル名", - "type": "ファイル形式", - "splitlines": "改行でメッセージを分割" - }, - "action": { - "text": "文字列", - "binary": "バイナリバッファ" - }, - "errors": { - "windowsnotsupport": "現在Windows上での動作は対応していません" - } - }, "file": { "label": { "filename": "ファイル名", diff --git a/packages/node_modules/@node-red/nodes/locales/ja/storage/28-tail.html b/packages/node_modules/@node-red/nodes/locales/ja/storage/28-tail.html deleted file mode 100644 index 513038593..000000000 --- a/packages/node_modules/@node-red/nodes/locales/ja/storage/28-tail.html +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json b/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json index cc5a4cf64..c946d6529 100644 --- a/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/zh-CN/messages.json @@ -784,20 +784,6 @@ "pythoncommandnotfound": "nrpgio python命令未处于运行状态" } }, - "tail": { - "label": { - "filename": "文件名", - "type": "文件类型", - "splitlines": "以\\n来拆分行?" - }, - "action": { - "text": "文本 - 返回字符串", - "binary": "二进制 - 返回Buffer" - }, - "errors": { - "windowsnotsupport": "Windows目前不支持." - } - }, "file": { "label": { "filename": "文件名", From 0dd40a941b5d1448cd1b88315cbe93657e0b5a5b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 7 Dec 2018 16:43:06 +0000 Subject: [PATCH 21/25] Handle 3rd party node trying to use core node-red icon --- .../node_modules/@node-red/editor-client/src/js/ui/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js index d8a4f1e7d..1e924405c 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js @@ -789,7 +789,11 @@ RED.utils = (function() { return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file; } } else { - if (def.category === 'subflows') { + // This could be a non-core node trying to use a core icon. + iconPath.module = 'node-red'; + if (isIconExists(iconPath)) { + return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file; + } else if (def.category === 'subflows') { return RED.settings.apiRootUrl+"icons/node-red/subflow.png"; } else { return RED.settings.apiRootUrl+"icons/node-red/arrow-in.png"; From fefabef9ee6643c6fbb63f5761024e2422313857 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 7 Dec 2018 16:44:14 +0000 Subject: [PATCH 22/25] Bump for 0.20.0.beta.2 --- CHANGELOG.md | 2 +- package.json | 2 +- .../node_modules/@node-red/editor-api/package.json | 6 +++--- .../node_modules/@node-red/editor-client/package.json | 2 +- packages/node_modules/@node-red/nodes/package.json | 2 +- packages/node_modules/@node-red/registry/package.json | 4 ++-- packages/node_modules/@node-red/runtime/package.json | 6 +++--- packages/node_modules/@node-red/util/package.json | 2 +- packages/node_modules/node-red/package.json | 10 +++++----- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b62d12bde..b4a07bf69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -#### 0.20.0.beta.1: Beta Release +#### 0.20.0.beta.2: Beta Release - Split Node-RED internals into multiple sub-modules diff --git a/package.json b/package.json index b49de8714..a5b445a78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "description": "A visual tool for wiring the Internet of Things", "homepage": "http://nodered.org", "license": "Apache-2.0", diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json index 9065d5682..7aff1b1d6 100644 --- a/packages/node_modules/@node-red/editor-api/package.json +++ b/packages/node_modules/@node-red/editor-api/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-api", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/util": "0.20.0-beta.1", - "@node-red/editor-client": "0.20.0-beta.1", + "@node-red/util": "0.20.0.beta.2", + "@node-red/editor-client": "0.20.0.beta.2", "bcryptjs": "2.4.3", "body-parser": "1.18.3", "clone": "2.1.2", diff --git a/packages/node_modules/@node-red/editor-client/package.json b/packages/node_modules/@node-red/editor-client/package.json index a4211344d..ba210c2d2 100644 --- a/packages/node_modules/@node-red/editor-client/package.json +++ b/packages/node_modules/@node-red/editor-client/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-client", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/nodes/package.json b/packages/node_modules/@node-red/nodes/package.json index 68c7354eb..659f94d6c 100644 --- a/packages/node_modules/@node-red/nodes/package.json +++ b/packages/node_modules/@node-red/nodes/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/nodes", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/registry/package.json b/packages/node_modules/@node-red/registry/package.json index c53bdcf0d..8d5217a6f 100644 --- a/packages/node_modules/@node-red/registry/package.json +++ b/packages/node_modules/@node-red/registry/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/registry", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,7 +16,7 @@ } ], "dependencies": { - "@node-red/util": "0.20.0-beta.1", + "@node-red/util": "0.20.0.beta.2", "semver": "5.6.0", "uglify-js": "3.4.9", "when": "3.7.8" diff --git a/packages/node_modules/@node-red/runtime/package.json b/packages/node_modules/@node-red/runtime/package.json index 12c510507..e18a5cb10 100644 --- a/packages/node_modules/@node-red/runtime/package.json +++ b/packages/node_modules/@node-red/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/runtime", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/registry": "0.20.0-beta.1", - "@node-red/util": "0.20.0-beta.1", + "@node-red/registry": "0.20.0.beta.2", + "@node-red/util": "0.20.0.beta.2", "clone": "2.1.2", "express": "4.16.4", "fs-extra": "7.0.1", diff --git a/packages/node_modules/@node-red/util/package.json b/packages/node_modules/@node-red/util/package.json index b690ea474..51bcf7b7d 100644 --- a/packages/node_modules/@node-red/util/package.json +++ b/packages/node_modules/@node-red/util/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/util", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/node-red/package.json b/packages/node_modules/node-red/package.json index f0167f9fd..5dfeb2b76 100644 --- a/packages/node_modules/node-red/package.json +++ b/packages/node_modules/node-red/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "0.20.0-beta.1", + "version": "0.20.0.beta.2", "description": "A visual tool for wiring the Internet of Things", "homepage": "http://nodered.org", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "flow" ], "dependencies": { - "@node-red/editor-api": "0.20.0-beta.1", - "@node-red/runtime": "0.20.0-beta.1", - "@node-red/util": "0.20.0-beta.1", - "@node-red/nodes": "0.20.0-beta.1", + "@node-red/editor-api": "0.20.0.beta.2", + "@node-red/runtime": "0.20.0.beta.2", + "@node-red/util": "0.20.0.beta.2", + "@node-red/nodes": "0.20.0.beta.2", "basic-auth": "2.0.1", "bcryptjs": "2.4.3", "express": "4.16.4", From 43530d4a5fc0745facdbb4c869fb02698f660ba7 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 7 Dec 2018 16:45:06 +0000 Subject: [PATCH 23/25] Remove tail/sentiment node tests --- test/nodes/core/analysis/72-sentiment_spec.js | 178 --------------- test/nodes/core/storage/28-tail_spec.js | 206 ------------------ 2 files changed, 384 deletions(-) delete mode 100644 test/nodes/core/analysis/72-sentiment_spec.js delete mode 100644 test/nodes/core/storage/28-tail_spec.js diff --git a/test/nodes/core/analysis/72-sentiment_spec.js b/test/nodes/core/analysis/72-sentiment_spec.js deleted file mode 100644 index 1cab6bf16..000000000 --- a/test/nodes/core/analysis/72-sentiment_spec.js +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -var should = require("should"); -var sentimentNode = require("nr-test-utils").require("@node-red/nodes/core/analysis/72-sentiment.js"); -var helper = require("node-red-node-test-helper"); - -describe('sentiment Node', function() { - - before(function(done) { - helper.startServer(done); - }); - - after(function(done) { - helper.stopServer(done); - }); - - afterEach(function() { - helper.unload(); - }); - - it('should be loaded', function(done) { - var flow = [{id:"sentimentNode1", type:"sentiment", name: "sentimentNode" }]; - helper.load(sentimentNode, flow, function() { - var sentimentNode1 = helper.getNode("sentimentNode1"); - sentimentNode1.should.have.property('name', 'sentimentNode'); - done(); - }); - }); - - it('should pass on msg if no payload', function(done) { - var flow = [{id:"jn1",type:"sentiment",wires:[["jn2"]]}, - {id:"jn2", type:"helper"}]; - helper.load(sentimentNode, flow, function() { - var jn1 = helper.getNode("jn1"); - var jn2 = helper.getNode("jn2"); - jn2.on("input", function(msg) { - msg.should.not.have.property('sentiment'); - msg.topic.should.equal("pass on"); - done(); - }); - var testString = 'good, great, best, brilliant'; - jn1.receive({topic:"pass on"}); - }); - }); - - it('should add a positive score for good words', function(done) { - var flow = [{id:"jn1",type:"sentiment",wires:[["jn2"]]}, - {id:"jn2", type:"helper"}]; - helper.load(sentimentNode, flow, function() { - var jn1 = helper.getNode("jn1"); - var jn2 = helper.getNode("jn2"); - jn2.on("input", function(msg) { - try { - msg.should.have.property('sentiment'); - msg.sentiment.should.have.property('score'); - msg.sentiment.score.should.be.a.Number(); - msg.sentiment.score.should.be.above(10); - done(); - } catch(err) { - done(err); - } - }); - var testString = 'good, great, best, brilliant'; - jn1.receive({payload:testString}); - }); - }); - - it('should add a positive score for good words - alternative property', function(done) { - var flow = [{id:"jn1",type:"sentiment",property:"foo",wires:[["jn2"]]}, - {id:"jn2", type:"helper"}]; - helper.load(sentimentNode, flow, function() { - var jn1 = helper.getNode("jn1"); - var jn2 = helper.getNode("jn2"); - jn2.on("input", function(msg) { - try { - msg.should.have.property('sentiment'); - msg.sentiment.should.have.property('score'); - msg.sentiment.score.should.be.a.Number(); - msg.sentiment.score.should.be.above(10); - done(); - } catch(err) { - done(err); - } - }); - var testString = 'good, great, best, brilliant'; - jn1.receive({foo:testString}); - }); - }); - - it('should add a negative score for bad words', function(done) { - var flow = [{id:"jn1",type:"sentiment",wires:[["jn2"]]}, - {id:"jn2", type:"helper"}]; - helper.load(sentimentNode, flow, function() { - var jn1 = helper.getNode("jn1"); - var jn2 = helper.getNode("jn2"); - jn2.on("input", function(msg) { - msg.should.have.property('sentiment'); - msg.sentiment.should.have.property('score'); - msg.sentiment.score.should.be.a.Number(); - msg.sentiment.score.should.be.below(-10); - done(); - }); - var testString = 'bad, horrible, negative, awful'; - jn1.receive({payload:testString}); - }); - }); - - it('should add a negative score for bad words - alternative property', function(done) { - var flow = [{id:"jn1",type:"sentiment",property:"foo",wires:[["jn2"]]}, - {id:"jn2", type:"helper"}]; - helper.load(sentimentNode, flow, function() { - var jn1 = helper.getNode("jn1"); - var jn2 = helper.getNode("jn2"); - jn2.on("input", function(msg) { - msg.should.have.property('sentiment'); - msg.sentiment.should.have.property('score'); - msg.sentiment.score.should.be.a.Number(); - msg.sentiment.score.should.be.below(-10); - done(); - }); - var testString = 'bad, horrible, negative, awful'; - jn1.receive({foo:testString}); - }); - }); - - it('should allow you to override word scoring', function(done) { - var flow = [{id:"jn1",type:"sentiment",wires:[["jn2"]]}, - {id:"jn2", type:"helper"}]; - helper.load(sentimentNode, flow, function() { - var jn1 = helper.getNode("jn1"); - var jn2 = helper.getNode("jn2"); - jn2.on("input", function(msg) { - msg.should.have.property('sentiment'); - msg.sentiment.should.have.property('score'); - msg.sentiment.score.should.be.a.Number(); - msg.sentiment.score.should.equal(20); - done(); - }); - var testString = 'sick, wicked'; - var overrides = {'sick': 10, 'wicked': 10 }; - jn1.receive({payload:testString,overrides:overrides}); - }); - }); - - it('should allow you to override word scoring - alternative property', function(done) { - var flow = [{id:"jn1",type:"sentiment",property:"foo",wires:[["jn2"]]}, - {id:"jn2", type:"helper"}]; - helper.load(sentimentNode, flow, function() { - var jn1 = helper.getNode("jn1"); - var jn2 = helper.getNode("jn2"); - jn2.on("input", function(msg) { - msg.should.have.property('sentiment'); - msg.sentiment.should.have.property('score'); - msg.sentiment.score.should.be.a.Number(); - msg.sentiment.score.should.equal(20); - done(); - }); - var testString = 'sick, wicked'; - var overrides = {'sick': 10, 'wicked': 10 }; - jn1.receive({foo:testString,overrides:overrides}); - }); - }); - -}); diff --git a/test/nodes/core/storage/28-tail_spec.js b/test/nodes/core/storage/28-tail_spec.js deleted file mode 100644 index 8c15efda5..000000000 --- a/test/nodes/core/storage/28-tail_spec.js +++ /dev/null @@ -1,206 +0,0 @@ -/** - * Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -var should = require("should"); -var path = require('path'); -var os = require('os'); -var fs = require('fs-extra'); -var sinon = require('sinon'); -var tailNode = require("nr-test-utils").require("@node-red/nodes/core/storage/28-tail.js"); -var helper = require("node-red-node-test-helper"); - -describe('tail Node', function() { - - var wait = 150; - var resourcesDir = path.join(__dirname,"..","..","..","resources"); - var fileToTail = path.join(resourcesDir,"28-tail-test-file.txt"); - - beforeEach(function(done) { - fs.writeFileSync(fileToTail, "Tail message line 1\nTail message line 2\n"); - helper.startServer(done); - }); - - afterEach(function(done) { - helper.unload().then(function() { - fs.unlinkSync(fileToTail); - helper.stopServer(done); - }); - }); - - if (os.type() !== "Windows_NT") { - it('should be loaded', function(done) { - var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail}]; - helper.load(tailNode, flow, function() { - var tailNode1 = helper.getNode("tailNode1"); - tailNode1.should.have.property('name', 'tailNode'); - done(); - }); - }); - - it('should tail a file', function(done) { - var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail, "wires":[["helperNode1"]]}, - {id:"helperNode1", type:"helper", wires:[]}]; - helper.load(tailNode, flow, function() { - var tailNode1 = helper.getNode("tailNode1"); - var helperNode1 = helper.getNode("helperNode1"); - var inputCounter = 0; - helperNode1.on("input", function(msg) { - //console.log(msg); - msg.should.have.property('topic', fileToTail); - msg.payload.should.equal("Tail message line " + (++inputCounter + 2)); - if (inputCounter === 2) { - done(); - } - }); - setTimeout( function() { - fs.appendFileSync(fileToTail, "Tail message line 3\n"); - fs.appendFileSync(fileToTail, "Tail message line 4\n"); - },wait); - }); - }); - - it('should work in non-split mode', function(done) { - var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":false, "filename":fileToTail, "wires":[["helperNode1"]]}, - {id:"helperNode1", type:"helper", wires:[]}]; - helper.load(tailNode, flow, function() { - var tailNode1 = helper.getNode("tailNode1"); - var helperNode1 = helper.getNode("helperNode1"); - helperNode1.on("input", function(msg) { - //console.log(msg); - msg.should.have.property('topic', fileToTail); - msg.payload.should.equal("Tail message line 5\nTail message line 6\n"); - done(); - }); - setTimeout( function() { - fs.appendFileSync(fileToTail, "Tail message line 5\nTail message line 6\n"); - },wait); - }); - }); - - it('should work in binary mode', function(done) { - var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "filetype":"binary", "filename":fileToTail, "wires":[["helperNode1"]]}, - {id:"helperNode1", type:"helper", wires:[]}]; - helper.load(tailNode, flow, function() { - var tailNode1 = helper.getNode("tailNode1"); - var helperNode1 = helper.getNode("helperNode1"); - helperNode1.on("input", function(msg) { - //console.log(msg); - msg.should.have.property('topic', fileToTail); - msg.payload.toString().should.equal("Tail message line 7\nTail message line 8\n"); - done(); - }); - setTimeout( function() { - fs.appendFileSync(fileToTail, "Tail message line 7\nTail message line 8\n"); - },wait); - }); - }); - - it('should handle a non-existent file', function(done) { - fs.writeFileSync(fileToTail, "Tail message line.\n"); - var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail, "wires":[["helperNode1"]]}, - {id:"helperNode1", type:"helper", wires:[]}]; - helper.load(tailNode, flow, function() { - var tailNode1 = helper.getNode("tailNode1"); - var helperNode1 = helper.getNode("helperNode1"); - helperNode1.on("input", function(msg) { - msg.should.have.property('topic', fileToTail); - msg.payload.should.equal("Tail message line"); - done(); - }); - setTimeout(function() { - fs.unlinkSync(fileToTail); - },500); - setTimeout( function() { - fs.writeFile(fileToTail, "Tail message line\n"); - },1000); - }); - }); - } - - it('should throw an error if run on Windows', function() { - // Stub os platform so we can make it look like windows - var os = require('os'); - var spy = sinon.stub(os, 'platform', function(arg) { return("windows"); }); - - /*jshint immed: false */ - try { - (function() { tailNode("1234"); }).should.throw(); - } catch (err) { - throw err; - } - finally { - os.platform.restore(); - } - }); - - /* - it('tail should handle file truncation', function(done) { - var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail, "wires":[["helperNode1"]]}, - {id:"helperNode1", type:"helper", wires:[]}]; - helper.load(tailNode, flow, function() { - var tailNode1 = helper.getNode("tailNode1"); - var helperNode1 = helper.getNode("helperNode1"); - var inputCounter = 0; - var warned = false; - tailNode1.on("log", function(msg) { - if (msg.level == "warn") { warned = true; } - }); - helperNode1.on("input", function(msg) { - console.log("inputCounter =",inputCounter); - console.log(msg); - msg.should.have.property('topic', fileToTail); - inputCounter++; - if (inputCounter === 1) { - warned.should.be.false(); - msg.payload.should.equal("Tail message line append"); - } else if (inputCounter === 2) { - msg.payload.should.equal("Tail message line truncate"); - } else { - msg.payload.should.equal("Tail message line append "+inputCounter); - } - - if (inputCounter === 5) { - setTimeout(function() { - warned.should.be.true(); - done(); - },100); - } - }); - var actions = [ - function() { fs.appendFileSync(fileToTail, "Tail message line append\n");}, - function() { fs.writeFileSync(fileToTail, "Tail message line truncate\n");}, - function() { fs.appendFileSync(fileToTail, "Tail message line append 3\n");}, - function() { fs.appendFileSync(fileToTail, "Tail message line append 4\n");}, - function() { fs.appendFileSync(fileToTail, "Tail message line append 5\n");} - ]; - - function processAction() { - var action = actions.shift(); - action(); - if (actions.length > 0) { - setTimeout(function() { - processAction(); - },250); - } - } - setTimeout( function() { - processAction(); - },wait); - }); - }); - */ - -}); From 7173895d36d68c92c4cbd20bac710fa4295c2973 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 7 Dec 2018 16:47:19 +0000 Subject: [PATCH 24/25] Fixup version --- CHANGELOG.md | 2 +- package.json | 2 +- .../node_modules/@node-red/editor-api/package.json | 6 +++--- .../node_modules/@node-red/editor-client/package.json | 2 +- packages/node_modules/@node-red/nodes/package.json | 2 +- packages/node_modules/@node-red/registry/package.json | 4 ++-- packages/node_modules/@node-red/runtime/package.json | 6 +++--- packages/node_modules/@node-red/util/package.json | 2 +- packages/node_modules/node-red/package.json | 10 +++++----- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4a07bf69..e281e1c29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -#### 0.20.0.beta.2: Beta Release +#### 0.20.0.beta-2: Beta Release - Split Node-RED internals into multiple sub-modules diff --git a/package.json b/package.json index a5b445a78..6ea749980 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "description": "A visual tool for wiring the Internet of Things", "homepage": "http://nodered.org", "license": "Apache-2.0", diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json index 7aff1b1d6..ddd256a51 100644 --- a/packages/node_modules/@node-red/editor-api/package.json +++ b/packages/node_modules/@node-red/editor-api/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-api", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/util": "0.20.0.beta.2", - "@node-red/editor-client": "0.20.0.beta.2", + "@node-red/util": "0.20.0.beta-2", + "@node-red/editor-client": "0.20.0.beta-2", "bcryptjs": "2.4.3", "body-parser": "1.18.3", "clone": "2.1.2", diff --git a/packages/node_modules/@node-red/editor-client/package.json b/packages/node_modules/@node-red/editor-client/package.json index ba210c2d2..a74761f90 100644 --- a/packages/node_modules/@node-red/editor-client/package.json +++ b/packages/node_modules/@node-red/editor-client/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-client", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/nodes/package.json b/packages/node_modules/@node-red/nodes/package.json index 659f94d6c..90a3d4fca 100644 --- a/packages/node_modules/@node-red/nodes/package.json +++ b/packages/node_modules/@node-red/nodes/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/nodes", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/registry/package.json b/packages/node_modules/@node-red/registry/package.json index 8d5217a6f..5ca93fb75 100644 --- a/packages/node_modules/@node-red/registry/package.json +++ b/packages/node_modules/@node-red/registry/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/registry", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,7 +16,7 @@ } ], "dependencies": { - "@node-red/util": "0.20.0.beta.2", + "@node-red/util": "0.20.0.beta-2", "semver": "5.6.0", "uglify-js": "3.4.9", "when": "3.7.8" diff --git a/packages/node_modules/@node-red/runtime/package.json b/packages/node_modules/@node-red/runtime/package.json index e18a5cb10..85393846d 100644 --- a/packages/node_modules/@node-red/runtime/package.json +++ b/packages/node_modules/@node-red/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/runtime", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/registry": "0.20.0.beta.2", - "@node-red/util": "0.20.0.beta.2", + "@node-red/registry": "0.20.0.beta-2", + "@node-red/util": "0.20.0.beta-2", "clone": "2.1.2", "express": "4.16.4", "fs-extra": "7.0.1", diff --git a/packages/node_modules/@node-red/util/package.json b/packages/node_modules/@node-red/util/package.json index 51bcf7b7d..53f59f2ac 100644 --- a/packages/node_modules/@node-red/util/package.json +++ b/packages/node_modules/@node-red/util/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/util", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/node-red/package.json b/packages/node_modules/node-red/package.json index 5dfeb2b76..640ae85d6 100644 --- a/packages/node_modules/node-red/package.json +++ b/packages/node_modules/node-red/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "0.20.0.beta.2", + "version": "0.20.0.beta-2", "description": "A visual tool for wiring the Internet of Things", "homepage": "http://nodered.org", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "flow" ], "dependencies": { - "@node-red/editor-api": "0.20.0.beta.2", - "@node-red/runtime": "0.20.0.beta.2", - "@node-red/util": "0.20.0.beta.2", - "@node-red/nodes": "0.20.0.beta.2", + "@node-red/editor-api": "0.20.0.beta-2", + "@node-red/runtime": "0.20.0.beta-2", + "@node-red/util": "0.20.0.beta-2", + "@node-red/nodes": "0.20.0.beta-2", "basic-auth": "2.0.1", "bcryptjs": "2.4.3", "express": "4.16.4", From acf8c9bc4a14011fd38a379ea397f0e11518dde1 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 7 Dec 2018 16:49:37 +0000 Subject: [PATCH 25/25] Fixup version again because its Friday afternoon --- CHANGELOG.md | 2 +- package.json | 2 +- .../node_modules/@node-red/editor-api/package.json | 6 +++--- .../node_modules/@node-red/editor-client/package.json | 2 +- packages/node_modules/@node-red/nodes/package.json | 2 +- packages/node_modules/@node-red/registry/package.json | 4 ++-- packages/node_modules/@node-red/runtime/package.json | 6 +++--- packages/node_modules/@node-red/util/package.json | 2 +- packages/node_modules/node-red/package.json | 10 +++++----- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e281e1c29..ddc779750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -#### 0.20.0.beta-2: Beta Release +#### 0.20.0-beta.2: Beta Release - Split Node-RED internals into multiple sub-modules diff --git a/package.json b/package.json index 6ea749980..9a0d1befd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "description": "A visual tool for wiring the Internet of Things", "homepage": "http://nodered.org", "license": "Apache-2.0", diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json index ddd256a51..df5585556 100644 --- a/packages/node_modules/@node-red/editor-api/package.json +++ b/packages/node_modules/@node-red/editor-api/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-api", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/util": "0.20.0.beta-2", - "@node-red/editor-client": "0.20.0.beta-2", + "@node-red/util": "0.20.0-beta.2", + "@node-red/editor-client": "0.20.0-beta.2", "bcryptjs": "2.4.3", "body-parser": "1.18.3", "clone": "2.1.2", diff --git a/packages/node_modules/@node-red/editor-client/package.json b/packages/node_modules/@node-red/editor-client/package.json index a74761f90..4606e7a4a 100644 --- a/packages/node_modules/@node-red/editor-client/package.json +++ b/packages/node_modules/@node-red/editor-client/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-client", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/nodes/package.json b/packages/node_modules/@node-red/nodes/package.json index 90a3d4fca..16f637b8b 100644 --- a/packages/node_modules/@node-red/nodes/package.json +++ b/packages/node_modules/@node-red/nodes/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/nodes", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/registry/package.json b/packages/node_modules/@node-red/registry/package.json index 5ca93fb75..15c8839db 100644 --- a/packages/node_modules/@node-red/registry/package.json +++ b/packages/node_modules/@node-red/registry/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/registry", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,7 +16,7 @@ } ], "dependencies": { - "@node-red/util": "0.20.0.beta-2", + "@node-red/util": "0.20.0-beta.2", "semver": "5.6.0", "uglify-js": "3.4.9", "when": "3.7.8" diff --git a/packages/node_modules/@node-red/runtime/package.json b/packages/node_modules/@node-red/runtime/package.json index 85393846d..ed5655728 100644 --- a/packages/node_modules/@node-red/runtime/package.json +++ b/packages/node_modules/@node-red/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/runtime", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/registry": "0.20.0.beta-2", - "@node-red/util": "0.20.0.beta-2", + "@node-red/registry": "0.20.0-beta.2", + "@node-red/util": "0.20.0-beta.2", "clone": "2.1.2", "express": "4.16.4", "fs-extra": "7.0.1", diff --git a/packages/node_modules/@node-red/util/package.json b/packages/node_modules/@node-red/util/package.json index 53f59f2ac..8fe360f5d 100644 --- a/packages/node_modules/@node-red/util/package.json +++ b/packages/node_modules/@node-red/util/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/util", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/node-red/package.json b/packages/node_modules/node-red/package.json index 640ae85d6..ed849cbe3 100644 --- a/packages/node_modules/node-red/package.json +++ b/packages/node_modules/node-red/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "0.20.0.beta-2", + "version": "0.20.0-beta.2", "description": "A visual tool for wiring the Internet of Things", "homepage": "http://nodered.org", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "flow" ], "dependencies": { - "@node-red/editor-api": "0.20.0.beta-2", - "@node-red/runtime": "0.20.0.beta-2", - "@node-red/util": "0.20.0.beta-2", - "@node-red/nodes": "0.20.0.beta-2", + "@node-red/editor-api": "0.20.0-beta.2", + "@node-red/runtime": "0.20.0-beta.2", + "@node-red/util": "0.20.0-beta.2", + "@node-red/nodes": "0.20.0-beta.2", "basic-auth": "2.0.1", "bcryptjs": "2.4.3", "express": "4.16.4",