diff --git a/CHANGELOG.md b/CHANGELOG.md index 716ddc095..f7e70ca90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +### 1.2.0: Milestone Release + +Editor + + - Fix selection of link node not existing within active workspace #2722 (@HiroyasuNishiyama) + - Fix import of merged flow + - Fix width of upload button in Safari #2718 (@HiroyasuNishiyama) + - Update Chinese translations #2719 (@JiyeYu) + - Update Japanese translations needed for 1.2 #2710 (@kazuhitoyokoi) + - Fix unexpected line break of sidebar tab name popover #2716 (@HiroyasuNishiyama) + - i18n module refresh tooltip #2717 (@HiroyasuNishiyama) + - Add better error message if context file gets corrupted + - Update info text of function node #2714 (@HiroyasuNishiyama) + - Use markdown editor if editText called with md mode + - Prevent group actions when in non-default mouse mode + ### 1.2.0-beta.1: Beta Release Editor diff --git a/package.json b/package.json index f979741a4..5d30d9ba0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "1.2.0-beta.1", + "version": "1.2.0", "description": "Low-code programming for event-driven applications", "homepage": "http://nodered.org", "license": "Apache-2.0", @@ -26,7 +26,7 @@ } ], "dependencies": { - "ajv": "6.12.5", + "ajv": "6.12.6", "async-mutex": "0.2.4", "basic-auth": "2.0.1", "bcryptjs": "2.4.3", @@ -73,7 +73,7 @@ "request": "2.88.0", "semver": "6.3.0", "tar": "6.0.5", - "uglify-js": "3.11.0", + "uglify-js": "3.11.2", "when": "3.7.8", "ws": "6.2.1", "xml2js": "0.4.23" @@ -111,7 +111,7 @@ "mosca": "^2.8.3", "node-red-node-test-helper": "^0.2.5", "node-sass": "^4.14.1", - "nodemon": "2.0.4", + "nodemon": "2.0.5", "should": "13.2.3", "sinon": "1.17.7", "stoppable": "^1.1.0", diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json index ed406d651..ac7a99dad 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": "1.2.0-beta.1", + "version": "1.2.0", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/util": "1.2.0-beta.1", - "@node-red/editor-client": "1.2.0-beta.1", + "@node-red/util": "1.2.0", + "@node-red/editor-client": "1.2.0", "bcryptjs": "2.4.3", "body-parser": "1.19.0", "clone": "2.1.2", diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index 9fe4ef33e..e68fe32f9 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -545,6 +545,7 @@ "sortRecent": "recent", "more": "+ __count__ more", "upload": "Upload module tgz file", + "refresh": "Refresh module list", "errors": { "catalogLoadFailed": "

Failed to load node catalogue.

Check the browser console for more information

", "installFailed": "

Failed to install: __module__

__message__

Check the log for more information

", diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index 207ab0ad7..feaa627e5 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -545,6 +545,7 @@ "sortRecent": "日付順", "more": "+ さらに __count__ 個", "upload": "モジュールのtgzファイルをアップロード", + "refresh": "モジュールリスト更新", "errors": { "catalogLoadFailed": "

ノードのカタログの読み込みに失敗しました。

詳細はブラウザのコンソールを確認してください。

", "installFailed": "

追加処理が失敗しました: __module__

__message__

詳細はログを確認してください。

", diff --git a/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json b/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json index 3da4a5822..e123aef1e 100644 --- a/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json @@ -22,7 +22,8 @@ "color": "颜色", "position": "位置", "enable": "启用", - "disable": "禁用" + "disable": "禁用", + "upload": "上传" }, "type": { "string": "字符串", @@ -197,6 +198,8 @@ "flow_plural": "__count__ 个流程", "subflow": "__count__ 个子流程", "subflow_plural": "__count__ 子流程", + "replacedNodes": "__count__ 个节点被置换", + "replacedNodes_plural": "__count__ 个节点被置换", "pasteNodes": "在这里粘贴节点", "selectFile": "选择要导入的文件", "importNodes": "导入节点", @@ -212,6 +215,9 @@ "groupCopied_plural": "已复制 __count__ 个groups", "groupStyleCopied": "已复制组风格", "invalidFlow": "无效的流程: __message__", + "recoveredNodes": "复原的节点", + "recoveredNodesInfo": "导入节点时,此流上的节点缺少有效的流ID。 它们已被添加到此流中,您可以复原或删除它们。", + "recoveredNodesNotification": "

导入的节点缺少有效的流ID

已将它们添加到名为 '__flowName__'的新流中。

", "export": { "selected": "已选择的节点", "current": "现在的节点", @@ -226,13 +232,19 @@ }, "import": { "import": "导入到", + "importSelected": "导入所选项", + "importCopy": "导入副本", + "viewNodes": "查看节点", "newFlow": "新流程", + "replace": "置换", "errors": { "notArray": "输入的不是JSON数组", "itemNotObject": "输入的流无效 - 项目 __index__ 不是节点对象", "missingId": "输入的流无效-项 __index__ 缺少'id'属性", "missingType": "输入的流程无效-项 __index__ 缺少'类型'属性" - } + }, + "conflictNotification1": "您要导入的某些节点已经存在于工作空间中。", + "conflictNotification2": "选择要导入的节点,并确认要替换现有的节点还是导入它们的副本" }, "copyMessagePath": "已复制路径", "copyMessageValue": "已复制数值", @@ -533,6 +545,7 @@ "sortAZ": "a-z顺序", "sortRecent": "日期顺序", "more": "增加 __count__ 个", + "upload": "上传模块tgz文件", "errors": { "catalogLoadFailed": "无法加载节点目录。
查看浏览器控制台了解更多信息", "installFailed": "无法安装: __module__
__message__
查看日志了解更多信息", @@ -709,6 +722,12 @@ "committerTip": "保留空白以使用系统默认值", "userName": "用户名", "email": "电子邮件", + "workflow": "工作流", + "workfowTip": "选择您偏好的工作流", + "workflowManual": "手动", + "workflowManualTip": "所有更改都必须在“历史记录”侧边栏中手动提交", + "workflowAuto": "自动", + "workflowAutoTip": "每次部署后都会自动提交更改", "sshKeys": "SSH密钥", "sshKeysTip": "允许您创建到远程git存储库的安全连接。", "add": "添加密钥", diff --git a/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json b/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json index 644d28b12..54b884682 100644 --- a/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json @@ -22,7 +22,8 @@ "color": "顏色", "position": "位置", "enable": "啟用", - "disable": "禁用" + "disable": "禁用", + "upload": "上傳" }, "type": { "string": "字符串", @@ -197,6 +198,8 @@ "flow_plural": "__count__ 多流程", "subflow": "__count__ 子流程", "subflow_plural": "__count__ 多子流程", + "replacedNodes": "__count__ 個節點被置換", + "replacedNodes_plural": "__count__ 個節點被置換", "pasteNodes": "在這裡粘貼節點", "selectFile": "匯入所選檔案", "importNodes": "匯入節點", @@ -212,6 +215,9 @@ "groupCopied_plural": "已複製 __count__ 個groups", "groupStyleCopied": "已複製組風格", "invalidFlow": "無效的流程: __message__", + "recoveredNodes": "復原的節點", + "recoveredNodesInfo": "導入節點時,此流上的節點缺少有效的流ID。它們已被添加到此流中,您可以復原或刪除它們。", + "recoveredNodesNotification": "

導入的節點缺少有效的流ID

已將它們添加到名為 '__flowName__'的新流中。

", "export": { "selected": "已選擇的節點", "current": "現在的節點", @@ -226,13 +232,19 @@ }, "import": { "import": "匯入到", + "importSelected": "導入所選項", + "importCopy": "導入副本", + "viewNodes": "查看節點", "newFlow": "新流程", + "replace": "置換", "errors": { "notArray": "輸入的不是JSON數組", "itemNotObject": "輸入的流程無效-項目 __index__ 不是節點對象", "missingId": "輸入的流程無效-項 __index__ 缺少“ id”屬性", "missingType": "輸入的流程無效-項 __index__ 缺少“類型”屬性" - } + }, + "conflictNotification1": "您要導入的某些節點已經存在於工作空間中。", + "conflictNotification2": "選擇要導入的節點,並確認要替換現有的節點還是導入它們的副本" }, "copyMessagePath": "已複製路徑", "copyMessageValue": "已複製數值", @@ -533,6 +545,7 @@ "sortAZ": "a-z順序", "sortRecent": "日期順序", "more": "增加 __count__ 個", + "upload": "上傳模塊tgz文件", "errors": { "catalogLoadFailed": "無法載入節點目錄。
查看瀏覽器控制臺瞭解更多資訊", "installFailed": "無法安裝: __module__
__message__
查看日誌瞭解更多資訊", @@ -709,6 +722,12 @@ "committerTip": "保留空白以使用系統默認值", "userName": "用戶名", "email": "電子郵件", + "workflow": "工作流", + "workfowTip": "選擇您偏好的工作流", + "workflowManual": "手動", + "workflowManualTip": "所有更改都必須在“歷史記錄”側邊欄中手動提交", + "workflowAuto": "自動", + "workflowAutoTip": "每次部署後都會自動提交更改", "sshKeys": "SSH密鑰", "sshKeysTip": "允許您創建到遠程git存儲庫的安全連接。", "add": "添加密鑰", diff --git a/packages/node_modules/@node-red/editor-client/package.json b/packages/node_modules/@node-red/editor-client/package.json index d7e6c187a..0af9d4b7e 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": "1.2.0-beta.1", + "version": "1.2.0", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/editor-client/src/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js index ca896ff63..af83e2d53 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/nodes.js +++ b/packages/node_modules/@node-red/editor-client/src/js/nodes.js @@ -1842,6 +1842,8 @@ RED.nodes = (function() { }); defaultWorkspace = null; initialLoad = null; + workspaces = {}; + RED.nodes.dirty(false); RED.view.redraw(true, true); RED.palette.refresh(); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js index afda75390..78aacba52 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js @@ -84,6 +84,7 @@ RED.popover = (function() { var targetHeight = target.outerHeight(); var divHeight = div.height(); var divWidth = div.width(); + var paddingRight = 10; var viewportTop = $(window).scrollTop(); var viewportLeft = $(window).scrollLeft(); @@ -105,7 +106,7 @@ RED.popover = (function() { d = "right"; top = targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top; left = targetPos.left+targetWidth+deltaSizes[size].leftRight; - } else if (left+divWidth > viewportRight) { + } else if (left+divWidth+paddingRight > viewportRight) { d = "left"; top = targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top; left = targetPos.left-deltaSizes[size].leftLeft-divWidth; diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js index c1346487d..81cd407eb 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js @@ -617,6 +617,7 @@ RED.tabs = (function() { } }, stop: function(event,ui) { + dragActive = false; collapsedButtonsRow.children().css({position:"relative",left:"",transition:""}); $(".red-ui-tab-link-buttons").width('auto'); pinnedLink.css({zIndex:""}); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js b/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js index 13a157e21..a039e0172 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js @@ -1411,7 +1411,7 @@ RED.diff = (function() { // Restore the original flow so subsequent merge resolutions can properly // identify new-vs-old RED.nodes.originalFlow(originalFlow); - imported[0].forEach(function(n) { + imported.nodes.forEach(function(n) { if (nodeChangedStates[n.id] || localChangedStates[n.id]) { n.changed = true; } 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 1bd7af251..4488f86c0 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 @@ -2788,7 +2788,13 @@ RED.editor = (function() { editExpression: function(options) { showTypeEditor("_expression", options) }, editJSON: function(options) { showTypeEditor("_json", options) }, editMarkdown: function(options) { showTypeEditor("_markdown", options) }, - editText: function(options) { showTypeEditor("_text", options) }, + editText: function(options) { + if (options.mode == "markdown") { + showTypeEditor("_markdown", options) + } else { + showTypeEditor("_text", options) + } + }, editBuffer: function(options) { showTypeEditor("_buffer", options) }, buildEditForm: buildEditForm, validateNode: validateNode, diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js index e2bb3b30f..b0aeed0fe 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js @@ -796,7 +796,7 @@ RED.palette.editor = (function() { loadedIndex = {}; initInstallTab(); }) - RED.popover.tooltip(refreshButton,"NLS-TODO: Refresh module list"); + RED.popover.tooltip(refreshButton,RED._("palette.editor.refresh")); packageList = $('
    ',{style:"position: absolute;top: 79px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({ addButton: false, diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 3f9677f44..da6c2f27b 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -1892,7 +1892,8 @@ RED.view = (function() { activeLinkNodes = {}; for (var i=0;i

    The Setup tab contains code that will be run whenever the node is started. The Close tab contains code that will be run when the node is stopped.

    +

    If an promise object is returned from the setup code, input message processing starts after its completion.

    Details

    See the online documentation for more information on writing functions.

    @@ -34,6 +35,7 @@
  1. a single message object - passed to nodes connected to the first output
  2. an array of message objects - passed to nodes connected to the corresponding outputs
  3. +

    Note: The setup code is executed during the initialization of nodes. Therefore, if node.send is called in the setup tab, subsequent nodes may not be able to receive the message.

    If any element of the array is itself an array of messages, multiple messages are sent to the corresponding output.

    If null is returned, either by itself or as an element of the array, no diff --git a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html index b348512df..de6f44e3d 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html @@ -20,6 +20,7 @@

    msgオブジェクトはmsg.payloadプロパティにメッセージ本体を保持するのが慣例です。

    通常、コードはメッセージオブジェクト(もしくは複数のメッセージオブジェクト)を返却します。後続フローの実行を停止したい場合は、オブジェクトを返却しなくてもかまいません。

    Node-REDの開始時もしくはフローの設定をデプロイした際実行される初期化コードを初期化処理タブに、ノードの停止もしくは再デプロイ時に実行される終了処理コードを終了処理タブに指定できます。

    +

    初期化処理タブの返却値としてPromiseを返却すると、入力メッセージの処理を開始する前にその完了を待ちます。

    詳細

    コードの書き方の詳細については、オンラインドキュメントを参照してください。

    メッセージの送信

    @@ -29,6 +30,7 @@
  4. 単一メッセージオブジェクト - 最初の出力に接続されたノードに渡されます
  5. メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます
  6. +

    注: 初期化処理の実行はノードの初期化中に行われます。そのため、初期化処理タブにsendを記述した場合に後続ノードでメッセージを受け取れないことがあります。

    配列要素が配列の場合には、複数のメッセージを対応する出力に送出します。

    返却方法が単一値か配列要素かにかかわらず、返却値がnullの場合メッセージの送出は行いません。

    ログ出力とエラー処理

    diff --git a/packages/node_modules/@node-red/nodes/locales/zh-CN/function/89-trigger.html b/packages/node_modules/@node-red/nodes/locales/zh-CN/function/89-trigger.html index 5f27a5002..c375173ca 100644 --- a/packages/node_modules/@node-red/nodes/locales/zh-CN/function/89-trigger.html +++ b/packages/node_modules/@node-red/nodes/locales/zh-CN/function/89-trigger.html @@ -19,6 +19,8 @@

    输入

    +
    delay 数值
    +
    设置要应用于消息的延迟(以毫秒为单位)。仅当节点配置为允许消息去覆盖设置的的默认延迟间隔时,此选项才适用。
    reset
    如果收到带有此属性的消息,则将清除当前正在进行的任何超时或重复,且不会触发任何消息。
    @@ -27,6 +29,7 @@

    该节点可用于在流中创建一个超时。 默认情况下,当它收到一条消息时,它将发送一条带有1的有效荷载的消息。然后它将等待250毫秒,再发送第二条消息,其有效荷载为0。这可以用于使连接到Raspberry Pi GPIO引脚的LED闪烁等例子上。

    可以将发送的每个消息的有效荷载配置为各种值,包括不发送任何内容的选项。例如,将初始消息设置为nothing,然后选择将计时器与每个收到的消息一起扩展的选项,则该节点将充当看门狗计时器;仅在设置的间隔内未收到任何消息时才发送消息。

    如果设置为字符串类型,则该节点支持mustache模板语法。

    +

    如果节点中启用了该选项,则可以通过 msg.delay 覆盖发送消息之间的延迟。该值必须以毫秒为单位。

    如果节点收到具有reset属性或与节点中配置的匹配的有效荷载的消息,则将清除当前正在进行的任何超时或重复,并且不会触发任何消息。

    可以将节点配置为以固定的时间间隔重新发送消息,直到被收到的消息重置为止。

    (可选)可以将节点配置为将带有msg.topic的消息视为独立的流。

    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 7c5e50a5d..ee074c0fe 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 @@ -321,6 +321,7 @@ "h": "小时" }, "extend": " 如有新信息,延长延迟", + "override": "使用msg.delay覆盖延迟时间", "second": " 发送第二条消息到单独的输出", "label": { "trigger": "触发", diff --git a/packages/node_modules/@node-red/nodes/locales/zh-TW/function/89-trigger.html b/packages/node_modules/@node-red/nodes/locales/zh-TW/function/89-trigger.html index 6bbe72f4d..95dc0a8bc 100644 --- a/packages/node_modules/@node-red/nodes/locales/zh-TW/function/89-trigger.html +++ b/packages/node_modules/@node-red/nodes/locales/zh-TW/function/89-trigger.html @@ -19,6 +19,8 @@

    输入

    +
    delay 数值
    +
    設置要應用於消息的延遲(以毫秒為單位)。僅當節點配置為允許消息去覆蓋設置的的默認延遲間隔時,此選項才適用。
    reset
    如果收到带有此属性的消息,则将清除当前正在进行的任何超时或重复,且不会触发任何消息。
    @@ -27,6 +29,7 @@

    该节点可用于在流程中创建一个超时。 默认情况下,当它收到一条消息时,它将发送一条带有1的有效荷载的消息。然后它将等待250毫秒,再发送第二条消息,其有效荷载为0。这可以用于使连接到Raspberry Pi GPIO引脚的LED闪烁等例子上。

    可以将发送的每个消息的有效荷载配置为各种值,包括不发送任何内容的选项。例如,将初始消息设置为nothing,然后选择将计时器与每个收到的消息一起扩展的选项,则该节点将充当看门狗计时器;仅在设置的间隔内未收到任何消息时才发送消息。

    如果设置为字符串类型,则该节点支持mustache模板语法。

    +

    如果節點中啟用了該選項,則可以通過 msg.delay 覆蓋發送消息之間的延遲。該值必須以毫秒為單位。

    如果节点收到具有reset属性或与节点中配置的匹配的有效荷载的消息,则将清除当前正在进行的任何超时或重复,并且不会触发任何消息。

    可以将节点配置为以固定的时间间隔重新发送消息,直到被收到的消息重置为止。

    (可选)可以将节点配置为将带有msg.topic的消息视为独立的流程。

    diff --git a/packages/node_modules/@node-red/nodes/locales/zh-TW/messages.json b/packages/node_modules/@node-red/nodes/locales/zh-TW/messages.json index 6f8860de1..de48fe9f9 100644 --- a/packages/node_modules/@node-red/nodes/locales/zh-TW/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/zh-TW/messages.json @@ -321,6 +321,7 @@ "h": "小時" }, "extend": " 如有新資訊,延長延遲", + "override": "使用msg.delay覆蓋延遲時間", "second": " 發送第二條消息到單獨的輸出", "label": { "trigger": "觸發", diff --git a/packages/node_modules/@node-red/nodes/package.json b/packages/node_modules/@node-red/nodes/package.json index 79108b50c..d5bbf8ea0 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": "1.2.0-beta.1", + "version": "1.2.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -15,7 +15,7 @@ } ], "dependencies": { - "ajv": "6.12.5", + "ajv": "6.12.6", "body-parser": "1.19.0", "cheerio": "0.22.0", "content-type": "1.0.4", diff --git a/packages/node_modules/@node-red/registry/package.json b/packages/node_modules/@node-red/registry/package.json index f3140cb9a..d6b772e7e 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": "1.2.0-beta.1", + "version": "1.2.0", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,10 +16,10 @@ } ], "dependencies": { - "@node-red/util": "1.2.0-beta.1", + "@node-red/util": "1.2.0", "semver": "6.3.0", "tar": "6.0.5", - "uglify-js": "3.11.0", + "uglify-js": "3.11.2", "when": "3.7.8" } } diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/context/localfilesystem.js b/packages/node_modules/@node-red/runtime/lib/nodes/context/localfilesystem.js index 9755681d8..ef499f0f9 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/context/localfilesystem.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/context/localfilesystem.js @@ -137,16 +137,15 @@ function stringify(value) { return { json: result, circular: hasCircular }; } - -function writeFileAtomic(storagePath, content) { +async function writeFileAtomic(storagePath, content) { // To protect against file corruption, write to a tmp file first and then // rename to the destination file let finalFile = storagePath + ".json"; let tmpFile = finalFile + "."+Date.now()+".tmp"; - return fs.outputFile(tmpFile, content, "utf8").then(function() { - return fs.rename(tmpFile,finalFile); - }) + await fs.outputFile(tmpFile, content, "utf8"); + return fs.rename(tmpFile,finalFile); } + function LocalFileSystem(config){ this.config = config; this.storageBaseDir = getBasePath(this.config); @@ -169,6 +168,7 @@ LocalFileSystem.prototype.open = function(){ if (this.cache) { var scopes = []; var promises = []; + var contextFiles = []; return listFiles(self.storageBaseDir).then(function(files) { files.forEach(function(file) { var parts = file.split(path.sep); @@ -179,15 +179,22 @@ LocalFileSystem.prototype.open = function(){ } else { scopes.push(parts[1].substring(0,parts[1].length-5)+":"+parts[0]); } - promises.push(loadFile(path.join(self.storageBaseDir,file))); + let contextFile = path.join(self.storageBaseDir,file); + contextFiles.push(contextFile) + promises.push(loadFile(contextFile)); }) return Promise.all(promises); }).then(function(res) { scopes.forEach(function(scope,i) { - var data = res[i]?JSON.parse(res[i]):{}; - Object.keys(data).forEach(function(key) { - self.cache.set(scope,key,data[key]); - }) + try { + var data = res[i]?JSON.parse(res[i]):{}; + Object.keys(data).forEach(function(key) { + self.cache.set(scope,key,data[key]); + }) + } catch(err) { + let error = new Error(log._("context.localfilesystem.invalid-json",{file: contextFiles[i]})) + throw error; + } }); }).catch(function(err){ if(err.code == 'ENOENT') { 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 3047295de..bc866e09e 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 @@ -176,6 +176,7 @@ "error-invalid-default-module": "Default context store unknown: '__storage__'", "unknown-store": "Unknown context store '__name__' specified. Using default store.", "localfilesystem": { + "invalid-json": "Invalid JSON in context file '__file__'", "error-circular": "Context __scope__ contains a circular reference that cannot be persisted", "error-write": "Error writing context: __message__" } diff --git a/packages/node_modules/@node-red/runtime/package.json b/packages/node_modules/@node-red/runtime/package.json index 6d100365d..fc514cba6 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": "1.2.0-beta.1", + "version": "1.2.0", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/registry": "1.2.0-beta.1", - "@node-red/util": "1.2.0-beta.1", + "@node-red/registry": "1.2.0", + "@node-red/util": "1.2.0", "async-mutex": "0.2.4", "clone": "2.1.2", "express": "4.17.1", diff --git a/packages/node_modules/@node-red/util/package.json b/packages/node_modules/@node-red/util/package.json index fa4a068f5..91e951f02 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": "1.2.0-beta.1", + "version": "1.2.0", "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 96a0b7884..a80c4b470 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": "1.2.0-beta.1", + "version": "1.2.0", "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.2.0-beta.1", - "@node-red/runtime": "1.2.0-beta.1", - "@node-red/util": "1.2.0-beta.1", - "@node-red/nodes": "1.2.0-beta.1", + "@node-red/editor-api": "1.2.0", + "@node-red/runtime": "1.2.0", + "@node-red/util": "1.2.0", + "@node-red/nodes": "1.2.0", "basic-auth": "2.0.1", "bcryptjs": "2.4.3", "express": "4.17.1",