mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
19 Commits
1.0.1
...
export-sub
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e94634544c | ||
|
|
07fe5b247b | ||
|
|
c1c694035d | ||
|
|
147d2a02be | ||
|
|
6f91786f4d | ||
|
|
f62a933d1c | ||
|
|
451835fbeb | ||
|
|
547e7a1b21 | ||
|
|
053e3ba923 | ||
|
|
bf65dcd49b | ||
|
|
a1d186112a | ||
|
|
ca7a298509 | ||
|
|
ff4d58f648 | ||
|
|
a1e10e99fa | ||
|
|
16bda530f6 | ||
|
|
bf9e04d9db | ||
|
|
8df86a75b1 | ||
|
|
5056203023 | ||
|
|
a0026e66ce |
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,3 +1,25 @@
|
||||
#### 1.0.2: Maintenance Release
|
||||
|
||||
Runtime
|
||||
- Allow node.status() to be passed number/bool types
|
||||
- Allow node emitted events to have multiple arguments
|
||||
- #2323 Fixed docstrings to have them match the function signature (name of parameters).
|
||||
- #2318 NLS: Unify translations of "boolean"
|
||||
|
||||
Editor
|
||||
- Ensure node status is refreshed whenever node is edited
|
||||
- #2315 #2316 Ensure z property included in full message debug payload
|
||||
- #2321 Fixed editor.json (JA nls)
|
||||
- #2313 Fix element to collapse items in visual JSON editor
|
||||
- #2314 Insert divider in menu by calling RED.menu.addItem('id', null);
|
||||
|
||||
Nodes
|
||||
- Change: Fixup use of node.done
|
||||
- #2322 Template: Fix invalid JSON data in template node docs
|
||||
- #2320 File: Fixed a typo in 10-file.html (JA nls)
|
||||
- #2312 Template: Remove unnecessary comma in help text
|
||||
- #2319 Inject: Interval of inject node should be 596 hours or less.
|
||||
|
||||
#### 1.0.1: Maintenance Release
|
||||
|
||||
Runtime
|
||||
|
||||
15
Gruntfile.js
15
Gruntfile.js
@@ -562,7 +562,20 @@ module.exports = function(grunt) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
grunt.registerTask('generatePublishScript',
|
||||
'Generates a script to publish build output to npm',
|
||||
function () {
|
||||
const done = this.async();
|
||||
const generatePublishScript = require("./scripts/generate-publish-script.js");
|
||||
generatePublishScript().then(function(output) {
|
||||
grunt.log.writeln(output);
|
||||
|
||||
const filePath = path.join(grunt.config.get('paths.dist'),"modules","publish.sh");
|
||||
grunt.file.write(filePath,output);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
grunt.registerTask('setDevEnv',
|
||||
'Sets NODE_ENV=development so non-minified assets are used',
|
||||
function () {
|
||||
@@ -605,7 +618,7 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.registerTask('release',
|
||||
'Create distribution zip file',
|
||||
['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules']);
|
||||
['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules','generatePublishScript']);
|
||||
|
||||
grunt.registerTask('pack-modules',
|
||||
'Create module pack files for release',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Low-code programming for event-driven applications",
|
||||
"homepage": "http://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-api",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,8 +16,8 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "1.0.1",
|
||||
"@node-red/editor-client": "1.0.1",
|
||||
"@node-red/util": "1.0.2",
|
||||
"@node-red/editor-client": "1.0.2",
|
||||
"bcryptjs": "2.4.3",
|
||||
"body-parser": "1.19.0",
|
||||
"clone": "2.1.2",
|
||||
|
||||
@@ -955,7 +955,7 @@
|
||||
"confirm": "<p>デプロイされていない変更は失われます。</p><p>続けますか?</p>"
|
||||
},
|
||||
"send-req": {
|
||||
"auth-req": "リポジトリ対する認証が必要です",
|
||||
"auth-req": "リポジトリに対する認証が必要です",
|
||||
"username": "ユーザ名",
|
||||
"password": "パスワード",
|
||||
"passphrase": "パスフレーズ",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-client",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -244,7 +244,7 @@ RED.menu = (function() {
|
||||
|
||||
function addItem(id,opt) {
|
||||
var item = createMenuItem(opt);
|
||||
if (opt.group) {
|
||||
if (opt !== null && opt.group) {
|
||||
var groupItems = $("#"+id+"-submenu").children(".red-ui-menu-group-"+opt.group);
|
||||
if (groupItems.length === 0) {
|
||||
item.appendTo("#"+id+"-submenu");
|
||||
|
||||
@@ -202,6 +202,7 @@ RED.editor = (function() {
|
||||
function updateNodeProperties(node, outputMap) {
|
||||
node.resize = true;
|
||||
node.dirty = true;
|
||||
node.dirtyStatus = true;
|
||||
var removedLinks = [];
|
||||
if (node.ports) {
|
||||
if (outputMap) {
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
})
|
||||
}});
|
||||
options.push({id:"red-ui-editor-type-json-menu-collapse-children",icon:"fa fa-angle-double-up", label:RED._('jsonEditor.collapseItems'),onselect:function(){
|
||||
item.treeList.collapse();
|
||||
item.children.forEach(function(child) {
|
||||
child.treeList.collapse();
|
||||
})
|
||||
|
||||
@@ -62,7 +62,7 @@ module.exports = function(RED) {
|
||||
if (err) {
|
||||
done(RED._("debug.invalid-exp", {error: editExpression}));
|
||||
} else {
|
||||
done(null,{id:node.id, name:node.name, topic:msg.topic, msg:value, _path:msg._path});
|
||||
done(null,{id:node.id, z:node.z, name:node.name, topic:msg.topic, msg:value, _path:msg._path});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -88,7 +88,7 @@ module.exports = function(RED) {
|
||||
node.log("\n"+util.inspect(msg, {colors:useColors, depth:10}));
|
||||
}
|
||||
if (this.active && this.tosidebar) {
|
||||
sendDebug({id:node.id, name:node.name, topic:msg.topic, msg:msg, _path:msg._path});
|
||||
sendDebug({id:node.id, z:node.z, name:node.name, topic:msg.topic, msg:msg, _path:msg._path});
|
||||
}
|
||||
done();
|
||||
} else {
|
||||
|
||||
@@ -448,7 +448,7 @@ RED.debug = (function() {
|
||||
var metaRow = $('<div class="red-ui-debug-msg-meta"></div>').appendTo(msg);
|
||||
$('<span class="red-ui-debug-msg-date">'+ getTimestamp()+'</span>').appendTo(metaRow);
|
||||
if (sourceNode) {
|
||||
$('<a>',{href:"#",class:"red-ui-debug-msg-name"}).text('node: '+(sourceNode.name||sourceNode.id))
|
||||
$('<a>',{href:"#",class:"red-ui-debug-msg-name"}).text('node: '+sanitize(o.name||sourceNode.name||sourceNode.id))
|
||||
.appendTo(metaRow)
|
||||
.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
@@ -331,11 +331,11 @@ module.exports = function(RED) {
|
||||
this.on('input', function(msg, send, done) {
|
||||
applyRules(msg, 0, (err,msg) => {
|
||||
if (err) {
|
||||
node.error(err,msg);
|
||||
done(err);
|
||||
} else if (msg) {
|
||||
send(msg);
|
||||
done();
|
||||
}
|
||||
done();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,10 +35,12 @@
|
||||
<p> Beispiel: Wenn eine Vorlage von:
|
||||
<pre> Hallo {{payload.name}}. Heute ist {{date}} </pre>
|
||||
<p> eine Nachricht empfangt, die folgendes enthält:
|
||||
<pre> {
|
||||
Datum: "Montag"
|
||||
Payload: { Name: "Fred"}
|
||||
} </pre>
|
||||
<pre>{
|
||||
date: "Montag",
|
||||
payload: {
|
||||
name: "Fred"
|
||||
}
|
||||
}</pre>
|
||||
<p> wird die resultierende Nachrich wie folgt sein:
|
||||
<pre> Hallo Fred. Heute ist Montag </pre>
|
||||
<p> Es ist möglich, eine Eigenschaft aus dem Flowkontext oder dem globalen Kontext zu verwenden.
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
<pre>Hello {{payload.name}}. Today is {{date}}</pre>
|
||||
<p>receives a message containing:
|
||||
<pre>{
|
||||
date: "Monday"
|
||||
date: "Monday",
|
||||
payload: {
|
||||
name: "Fred",
|
||||
name: "Fred"
|
||||
}
|
||||
}</pre>
|
||||
<p>The resulting property will be:
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
"on": "on",
|
||||
"onstart": "Inject once after",
|
||||
"onceDelay": "seconds, then",
|
||||
"tip": "<b>Note:</b> \"interval between times\" and \"at a specific time\" will use cron.<br/>\"interval\" should be less than 596 hours.<br/>See info box for details.",
|
||||
"tip": "<b>Note:</b> \"interval between times\" and \"at a specific time\" will use cron.<br/>\"interval\" should be 596 hours or less.<br/>See info box for details.",
|
||||
"success": "Successfully injected: __label__",
|
||||
"errors": {
|
||||
"failed": "inject failed, see log for details",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</dl>
|
||||
<h3>詳細</h3>
|
||||
<p>injectノードを用いることで、指定したペイロード値を用いてフローを開始できます。デフォルトのペイロード値は現在時刻のタイムスタンプを1970年1月1日からの経過ミリ秒で表現した値です。</p>
|
||||
<p>文字列、数値、論理値、JavaScriptオブジェクト、フロー/グローバルコンテキストの値などの送出も可能です。</p>
|
||||
<p>文字列、数値、真偽値、JavaScriptオブジェクト、フロー/グローバルコンテキストの値などの送出も可能です。</p>
|
||||
<p> デフォルト設定では、エディタ内に表示されるボタンをクリックすることで、ノードを手動で起動できます。指定間隔もしくはスケジュールに従ってメッセージを送出するように設定することも可能です。</p>
|
||||
<p>また、フロー開始の際に一度だけメッセージを送出させることもできます。</p>
|
||||
<p>「<i>時間間隔</i>」に指定可能な値の最大値は、約596時間(もしくは24日)です。一日より長い間隔を扱いたい場合は、電源停止や再起動にも対応可能なスケジューラノードの利用を検討すると良いでしょう。</p>
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
<pre>こんにちは{{payload.name}}さん。今日は{{date}}です。</pre>
|
||||
<p>というテンプレートに対して、
|
||||
<pre>{
|
||||
date: "月曜日"
|
||||
date: "月曜日",
|
||||
payload: {
|
||||
name: "山田",
|
||||
name: "山田"
|
||||
}
|
||||
}</pre>
|
||||
<p>というメッセージを受信した場合、</p>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<p>Windowsではパスの区切り文字を(例えば、<code>\\ユーザー\\名前</code>のように)エスケープする必要があります。</p>
|
||||
<p>テキストファイルの場合、行毎に分割して各々メッセージを送信することができます。また、バイナリファイルの場合、小さな塊のバッファに分割して送信できます。バッファの分割単位はオペレーティングシステム依存ですが、一般に64k(Linux/Mac)もしくは41k(Windows)です。</p>
|
||||
<p>複数のメッセージに分割する場合、各メッセージには<code>parts</code>プロパティが設定され、メッセージ列を構成します。</p>
|
||||
<p>主力形式が文字列の場合、入力データのエンコーディングをエンコーディングリストから選択できます。</p>
|
||||
<p>出力形式が文字列の場合、入力データのエンコーディングをエンコーディングリストから選択できます。</p>
|
||||
<h4>旧式のエラー処理</h4>
|
||||
<p>Node-RED 0.17より前の版では、ファイルの読み込み時にエラーが発生すると<code>payload</code>を持たず<code>error</code>プロパティにエラーの詳細情報を設定したメッセージを送信します。この動作モードは非推奨であり、新しいノード実装ではデフォルトでは無効としています。ノードの設定により、必要に応じてこのモードを有効にできます。</p>
|
||||
<p>エラーはcatchノードで補足して処理することを推奨します。</p>
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
<pre>안녕하세요, {{payload.name}}씨. 오늘은 {{date}}입니다.</pre>
|
||||
<p>라는 템플릿에 대해,
|
||||
<pre>{
|
||||
date: "월요일"
|
||||
date: "월요일",
|
||||
payload: {
|
||||
name: "홍길동",
|
||||
name: "홍길동"
|
||||
}
|
||||
}</pre>
|
||||
<p>이라는 메세지를 수신한 경우,</p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/nodes",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/registry",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "1.0.1",
|
||||
"@node-red/util": "1.0.2",
|
||||
"semver": "6.3.0",
|
||||
"uglify-js": "3.6.0",
|
||||
"when": "3.7.8"
|
||||
|
||||
@@ -169,20 +169,20 @@ Node.prototype._emit = Node.prototype.emit;
|
||||
/**
|
||||
* Emit an event to all registered listeners.
|
||||
*/
|
||||
Node.prototype.emit = function(event,arg) {
|
||||
Node.prototype.emit = function(event, ...args) {
|
||||
var node = this;
|
||||
if (event === "input") {
|
||||
// When Pluggable Message Routing arrives, this will be called from
|
||||
// that and will already be sync/async depending on the router.
|
||||
if (this._asyncDelivery) {
|
||||
setImmediate(function() {
|
||||
node._emitInput(arg);
|
||||
node._emitInput.apply(node,args);
|
||||
});
|
||||
} else {
|
||||
this._emitInput(arg);
|
||||
this._emitInput.apply(this,args);
|
||||
}
|
||||
} else {
|
||||
this._emit(event,arg);
|
||||
this._emit.apply(this,arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,7 +539,12 @@ Node.prototype.metric = function(eventname, msg, metricValue) {
|
||||
* status: "simple text status"
|
||||
*/
|
||||
Node.prototype.status = function(status) {
|
||||
if (typeof(status) === "string") { status = {text:status}; }
|
||||
switch (typeof status) {
|
||||
case "string":
|
||||
case "number":
|
||||
case "boolean":
|
||||
status = {text:""+status}
|
||||
}
|
||||
this._flow.handleStatus(this,status);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/runtime",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,8 +16,8 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/registry": "1.0.1",
|
||||
"@node-red/util": "1.0.1",
|
||||
"@node-red/registry": "1.0.2",
|
||||
"@node-red/util": "1.0.2",
|
||||
"clone": "2.1.2",
|
||||
"express": "4.17.1",
|
||||
"fs-extra": "8.1.0",
|
||||
|
||||
@@ -301,7 +301,7 @@ function normalisePropertyExpression(str) {
|
||||
* front of the property expression if present.
|
||||
*
|
||||
* @param {Object} msg - the message object
|
||||
* @param {String} str - the property expression
|
||||
* @param {String} expr - the property expression
|
||||
* @return {any} the message property, or undefined if it does not exist
|
||||
* @memberof @node-red/util_util
|
||||
*/
|
||||
@@ -316,7 +316,7 @@ function getMessageProperty(msg,expr) {
|
||||
* Gets a property of an object.
|
||||
*
|
||||
* @param {Object} msg - the object
|
||||
* @param {String} str - the property expression
|
||||
* @param {String} expr - the property expression
|
||||
* @return {any} the object property, or undefined if it does not exist
|
||||
* @memberof @node-red/util_util
|
||||
*/
|
||||
@@ -468,7 +468,7 @@ function evaluateEnvProperty(value, node) {
|
||||
*
|
||||
* For example, `#:(file)::foo` results in ` { store: "file", key: "foo" }`.
|
||||
*
|
||||
* @param {String} value - the context property string to parse
|
||||
* @param {String} key - the context property string to parse
|
||||
* @return {Object} The parsed property
|
||||
* @memberof @node-red/util_util
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/util",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
10
packages/node_modules/node-red/package.json
vendored
10
packages/node_modules/node-red/package.json
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Low-code programming for event-driven applications",
|
||||
"homepage": "http://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
@@ -31,10 +31,10 @@
|
||||
"flow"
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/editor-api": "1.0.1",
|
||||
"@node-red/runtime": "1.0.1",
|
||||
"@node-red/util": "1.0.1",
|
||||
"@node-red/nodes": "1.0.1",
|
||||
"@node-red/editor-api": "1.0.2",
|
||||
"@node-red/runtime": "1.0.2",
|
||||
"@node-red/util": "1.0.2",
|
||||
"@node-red/nodes": "1.0.2",
|
||||
"basic-auth": "2.0.1",
|
||||
"bcryptjs": "2.4.3",
|
||||
"express": "4.17.1",
|
||||
|
||||
38
scripts/generate-publish-script.js
Normal file
38
scripts/generate-publish-script.js
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const path = require("path");
|
||||
const fs = require("fs-extra");
|
||||
const should = require("should");
|
||||
|
||||
function generateScript() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const packages = [
|
||||
"node-red-util",
|
||||
"node-red-runtime",
|
||||
"node-red-registry",
|
||||
"node-red-nodes",
|
||||
"node-red-editor-client",
|
||||
"node-red-editor-api",
|
||||
"node-red"
|
||||
];
|
||||
const rootPackage = require(path.join(__dirname,"..","package.json"));
|
||||
const version = rootPackage.version;
|
||||
|
||||
const tagArg = /-/.test(version) ? "--tag next" : ""
|
||||
|
||||
const lines = [];
|
||||
|
||||
packages.forEach(name => {
|
||||
lines.push(`npm publish ${name}-${version}.tgz ${tagArg}\n`);
|
||||
})
|
||||
resolve(lines.join(""))
|
||||
});
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
generateScript().then(output => {
|
||||
console.log(output);
|
||||
});
|
||||
} else {
|
||||
module.exports = generateScript;
|
||||
}
|
||||
@@ -613,9 +613,6 @@ describe('Node', function() {
|
||||
}
|
||||
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
|
||||
var status = {fill:"green",shape:"dot",text:"connected"};
|
||||
var topic;
|
||||
var message;
|
||||
var retain;
|
||||
|
||||
n.status(status);
|
||||
|
||||
@@ -624,6 +621,33 @@ describe('Node', function() {
|
||||
flow.handleStatus.args[0][1].should.eql(status);
|
||||
done();
|
||||
});
|
||||
it('publishes status for plain string', function(done) {
|
||||
var flow = { handleStatus: sinon.stub() }
|
||||
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
|
||||
n.status("text status");
|
||||
flow.handleStatus.called.should.be.true();
|
||||
flow.handleStatus.args[0][0].should.eql(n);
|
||||
flow.handleStatus.args[0][1].should.eql({text:"text status"});
|
||||
done();
|
||||
});
|
||||
it('publishes status for plain boolean', function(done) {
|
||||
var flow = { handleStatus: sinon.stub() }
|
||||
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
|
||||
n.status(false);
|
||||
flow.handleStatus.called.should.be.true();
|
||||
flow.handleStatus.args[0][0].should.eql(n);
|
||||
flow.handleStatus.args[0][1].should.eql({text:"false"});
|
||||
done();
|
||||
});
|
||||
it('publishes status for plain number', function(done) {
|
||||
var flow = { handleStatus: sinon.stub() }
|
||||
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
|
||||
n.status(123);
|
||||
flow.handleStatus.called.should.be.true();
|
||||
flow.handleStatus.args[0][0].should.eql(n);
|
||||
flow.handleStatus.args[0][1].should.eql({text:"123"});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user