You can modify your flows and deploy the changes to restart.
",
+ "safe-mode": "
Flows stopped in safe mode.
You can modify your flows and deploy the changes to restart.
",
"restartRequired": "Node-RED must be restarted to enable upgraded modules",
"credentials_load_failed": "
Flows stopped as the credentials could not be decrypted.
The flow credential file is encrypted, but the project's encryption key is missing or invalid.
",
- "credentials_load_failed_reset":"
Credentials could not be decrypted
The flow credential file is encrypted, but the project's encryption key is missing or invalid.
The flow credential file will be reset on the next deployment. Any existing flow credentials will be cleared.
",
+ "credentials_load_failed_reset": "
Credentials could not be decrypted
The flow credential file is encrypted, but the project's encryption key is missing or invalid.
The flow credential file will be reset on the next deployment. Any existing flow credentials will be cleared.
",
"missing_flow_file": "
Project flow file not found.
The project is not configured with a flow file.
",
"missing_package_file": "
Project package file not found.
The project is missing a package.json file.
",
"project_empty": "
The project is empty.
Do you want to create a default set of project files? Otherwise, you will have to manually add files to the project outside of the editor.
",
@@ -257,11 +257,11 @@
"recoveredNodesInfo": "The nodes on this flow were missing a valid flow id when they were imported. They have been added to this flow so you can either restore or delete them.",
"recoveredNodesNotification": "
Imported nodes without a valid flow id
They have been added to a new flow called '__flowName__'.
Before installing, please read the node's documentation. Some nodes have dependencies that cannot be automatically resolved and can require a restart of Node-RED.
",
+ "body": "
Installing '__module__'
Before installing, please read the node's documentation. Some nodes have dependencies that cannot be automatically resolved and can require a restart of Node-RED.
Updating the node will require a restart of Node-RED to complete the update. This must be done manually.
",
+ "body": "
Updating '__module__'
Updating the node will require a restart of Node-RED to complete the update. This must be done manually.
",
"title": "Update nodes"
},
"cannotUpdate": {
- "body":"An update for this node is available, but it is not installed in a location that the palette manager can update.
Please refer to the documentation for how to update this node."
+ "body": "An update for this node is available, but it is not installed in a location that the palette manager can update.
Please refer to the documentation for how to update this node."
},
"button": {
"review": "Open node information",
@@ -663,14 +663,14 @@
"showMore": "show more",
"showLess": "show less",
"flow": "Flow",
- "selection":"Selection",
- "nodes":"__count__ nodes",
+ "selection": "Selection",
+ "nodes": "__count__ nodes",
"flowDesc": "Flow Description",
"subflowDesc": "Subflow Description",
"nodeHelp": "Node Help",
- "none":"None",
+ "none": "None",
"arrayItems": "__count__ items",
- "showTips":"You can open the tips from the settings panel",
+ "showTips": "You can open the tips from the settings panel",
"outline": "Outline",
"empty": "empty",
"globalConfig": "Global Configuration Nodes",
@@ -701,8 +701,8 @@
"filtered": "__count__ hidden"
},
"context": {
- "name":"Context Data",
- "label":"context",
+ "name": "Context Data",
+ "label": "context",
"none": "none selected",
"refresh": "refresh to load",
"empty": "empty",
@@ -740,9 +740,9 @@
"files": "Files",
"flow": "Flow",
"credentials": "Credentials",
- "package":"Package",
- "packageCreate":"File will be created when changes are saved",
- "fileNotExist":"File does not exist",
+ "package": "Package",
+ "packageCreate": "File will be created when changes are saved",
+ "fileNotExist": "File does not exist",
"selectFile": "Select File",
"invalidEncryptionKey": "Invalid encryption key",
"encryptionEnabled": "Encryption enabled",
@@ -978,7 +978,7 @@
"title": "Buffer editor",
"modeString": "Handle as UTF-8 String",
"modeArray": "Handle as JSON array",
- "modeDesc":"
Buffer editor
The Buffer type is stored as a JSON array of byte values. The editor will attempt to parse the entered value as a JSON array. If it is not valid JSON, it will be treated as a UTF-8 String and converted to an array of the individual character code points.
For example, a value of Hello World will be converted to the JSON array:
The Buffer type is stored as a JSON array of byte values. The editor will attempt to parse the entered value as a JSON array. If it is not valid JSON, it will be treated as a UTF-8 String and converted to an array of the individual character code points.
For example, a value of Hello World will be converted to the JSON array:
"
},
"projects": {
"config-git": "Configure Git client",
@@ -1140,7 +1140,7 @@
"no-empty": "Cannot create default file set on a non-empty project",
"git-error": "git error"
},
- "errors" : {
+ "errors": {
"no-username-email": "Your Git client is not configured with a username/email.",
"unexpected": "An unexpected error occurred",
"code": "code"
@@ -1163,7 +1163,7 @@
"diagnostics": {
"title": "System Info"
},
- "languages" : {
+ "languages": {
"de": "German",
"en-US": "English",
"ja": "Japanese",
@@ -1174,18 +1174,18 @@
},
"validator": {
"errors": {
- "invalid-json": "Invalid JSON data: __error__",
- "invalid-json-prop": "__prop__: invalid JSON data: __error__",
- "invalid-prop": "Invalid property expression",
- "invalid-prop-prop": "__prop__: invalid property expression",
- "invalid-num": "Invalid number",
- "invalid-num-prop": "__prop__: invalid number",
- "invalid-regexp": "Invalid input pattern",
- "invalid-regex-prop": "__prop__: invalid input pattern",
- "missing-required-prop": "__prop__: property value missing",
- "invalid-config": "__prop__: invalid configuration node",
- "missing-config": "__prop__: missing configuration node",
- "validation-error": "__prop__: validation error: __node__, __id__: __error__"
- }
+ "invalid-json": "Invalid JSON data: __error__",
+ "invalid-json-prop": "__prop__: invalid JSON data: __error__",
+ "invalid-prop": "Invalid property expression",
+ "invalid-prop-prop": "__prop__: invalid property expression",
+ "invalid-num": "Invalid number",
+ "invalid-num-prop": "__prop__: invalid number",
+ "invalid-regexp": "Invalid input pattern",
+ "invalid-regex-prop": "__prop__: invalid input pattern",
+ "missing-required-prop": "__prop__: property value missing",
+ "invalid-config": "__prop__: invalid configuration node",
+ "missing-config": "__prop__: missing configuration node",
+ "validation-error": "__prop__: validation error: __node__, __id__: __error__"
+ }
}
}
diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json b/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json
index 21a7e735fd..a958868ee0 100755
--- a/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json
+++ b/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json
@@ -1,23 +1,23 @@
{
"info": {
- "tip0" : "You can remove the selected nodes or links with {{core:delete-selection}}",
- "tip1" : "Search for nodes using {{core:search}}",
- "tip2" : "{{core:toggle-sidebar}} will toggle the view of this sidebar",
- "tip3" : "You can manage your palette of nodes with {{core:manage-palette}}",
- "tip4" : "Your flow configuration nodes are listed in the sidebar panel. It can be accessed from the menu or with {{core:show-config-tab}}",
- "tip5" : "Enable or disable these tips from the option in the settings",
- "tip6" : "Move the selected nodes using the [left] [up] [down] and [right] keys. Hold [shift] to nudge them further",
- "tip7" : "Dragging a node onto a wire will splice it into the link",
- "tip8" : "Export the selected nodes, or the current tab with {{core:show-export-dialog}}",
- "tip9" : "Import a flow by dragging its JSON into the editor, or with {{core:show-import-dialog}}",
- "tip10" : "[shift] [click] and drag on a node port to move all of the attached wires or just the selected one",
- "tip11" : "Show the Info tab with {{core:show-info-tab}} or the Debug tab with {{core:show-debug-tab}}",
- "tip12" : "[ctrl] [click] in the workspace to open the quick-add dialog",
- "tip13" : "Hold down [ctrl] when you [click] on a node port to enable quick-wiring",
- "tip14" : "Hold down [shift] when you [click] on a node to also select all of its connected nodes",
- "tip15" : "Hold down [ctrl] when you [click] on a node to add or remove it from the current selection",
- "tip16" : "Switch flow tabs with {{core:show-previous-tab}} and {{core:show-next-tab}}",
- "tip17" : "You can confirm your changes in the node edit tray with {{core:confirm-edit-tray}} or cancel them with {{core:cancel-edit-tray}}",
- "tip18" : "Pressing {{core:edit-selected-node}} will edit the first node in the current selection"
+ "tip0": "You can remove the selected nodes or links with {{core:delete-selection}}",
+ "tip1": "Search for nodes using {{core:search}}",
+ "tip2": "{{core:toggle-sidebar}} will toggle the view of this sidebar",
+ "tip3": "You can manage your palette of nodes with {{core:manage-palette}}",
+ "tip4": "Your flow configuration nodes are listed in the sidebar panel. It can be accessed from the menu or with {{core:show-config-tab}}",
+ "tip5": "Enable or disable these tips from the option in the settings",
+ "tip6": "Move the selected nodes using the [left] [up] [down] and [right] keys. Hold [shift] to nudge them further",
+ "tip7": "Dragging a node onto a wire will splice it into the link",
+ "tip8": "Export the selected nodes, or the current tab with {{core:show-export-dialog}}",
+ "tip9": "Import a flow by dragging its JSON into the editor, or with {{core:show-import-dialog}}",
+ "tip10": "[shift] [click] and drag on a node port to move all of the attached wires or just the selected one",
+ "tip11": "Show the Info tab with {{core:show-info-tab}} or the Debug tab with {{core:show-debug-tab}}",
+ "tip12": "[ctrl] [click] in the workspace to open the quick-add dialog",
+ "tip13": "Hold down [ctrl] when you [click] on a node port to enable quick-wiring",
+ "tip14": "Hold down [shift] when you [click] on a node to also select all of its connected nodes",
+ "tip15": "Hold down [ctrl] when you [click] on a node to add or remove it from the current selection",
+ "tip16": "Switch flow tabs with {{core:show-previous-tab}} and {{core:show-next-tab}}",
+ "tip17": "You can confirm your changes in the node edit tray with {{core:confirm-edit-tray}} or cancel them with {{core:cancel-edit-tray}}",
+ "tip18": "Pressing {{core:edit-selected-node}} will edit the first node in the current selection"
}
}
diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json b/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json
index 6a00a3c095..b24a898b7e 100755
--- a/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json
+++ b/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json
@@ -52,52 +52,52 @@
"desc": "Finds occurrences of `pattern` within `str` and replaces them with `replacement`.\n\nThe optional `limit` parameter is the maximum number of replacements."
},
"$now": {
- "args":"$[picture [, timezone]]",
- "desc":"Generates a timestamp in ISO 8601 compatible format and returns it as a string. If the optional picture and timezone parameters are supplied, then the current timestamp is formatted as described by the `$fromMillis()` function"
+ "args": "$[picture [, timezone]]",
+ "desc": "Generates a timestamp in ISO 8601 compatible format and returns it as a string. If the optional picture and timezone parameters are supplied, then the current timestamp is formatted as described by the `$fromMillis()` function"
},
"$base64encode": {
- "args":"string",
- "desc":"Converts an ASCII string to a base 64 representation. Each character in the string is treated as a byte of binary data. This requires that all characters in the string are in the 0x00 to 0xFF range, which includes all characters in URI encoded strings. Unicode characters outside of that range are not supported."
+ "args": "string",
+ "desc": "Converts an ASCII string to a base 64 representation. Each character in the string is treated as a byte of binary data. This requires that all characters in the string are in the 0x00 to 0xFF range, which includes all characters in URI encoded strings. Unicode characters outside of that range are not supported."
},
"$base64decode": {
- "args":"string",
- "desc":"Converts base 64 encoded bytes to a string, using a UTF-8 Unicode codepage."
+ "args": "string",
+ "desc": "Converts base 64 encoded bytes to a string, using a UTF-8 Unicode codepage."
},
"$number": {
"args": "arg",
"desc": "Casts the `arg` parameter to a number using the following casting rules:\n\n - Numbers are unchanged\n - Strings that contain a sequence of characters that represent a legal JSON number are converted to that number\n - All other values cause an error to be thrown."
},
"$abs": {
- "args":"number",
- "desc":"Returns the absolute value of the `number` parameter."
+ "args": "number",
+ "desc": "Returns the absolute value of the `number` parameter."
},
"$floor": {
- "args":"number",
- "desc":"Returns the value of `number` rounded down to the nearest integer that is smaller or equal to `number`."
+ "args": "number",
+ "desc": "Returns the value of `number` rounded down to the nearest integer that is smaller or equal to `number`."
},
"$ceil": {
- "args":"number",
- "desc":"Returns the value of `number` rounded up to the nearest integer that is greater than or equal to `number`."
+ "args": "number",
+ "desc": "Returns the value of `number` rounded up to the nearest integer that is greater than or equal to `number`."
},
"$round": {
- "args":"number [, precision]",
- "desc":"Returns the value of the `number` parameter rounded to the number of decimal places specified by the optional `precision` parameter."
+ "args": "number [, precision]",
+ "desc": "Returns the value of the `number` parameter rounded to the number of decimal places specified by the optional `precision` parameter."
},
"$power": {
- "args":"base, exponent",
- "desc":"Returns the value of `base` raised to the power of `exponent`."
+ "args": "base, exponent",
+ "desc": "Returns the value of `base` raised to the power of `exponent`."
},
"$sqrt": {
- "args":"number",
- "desc":"Returns the square root of the value of the `number` parameter."
+ "args": "number",
+ "desc": "Returns the square root of the value of the `number` parameter."
},
"$random": {
- "args":"",
- "desc":"Returns a pseudo random number greater than or equal to zero and less than one."
+ "args": "",
+ "desc": "Returns a pseudo random number greater than or equal to zero and less than one."
},
"$millis": {
- "args":"",
- "desc":"Returns the number of milliseconds since the Unix Epoch (1 January, 1970 UTC) as a number. All invocations of `$millis()` within an evaluation of an expression will all return the same value."
+ "args": "",
+ "desc": "Returns the number of milliseconds since the Unix Epoch (1 January, 1970 UTC) as a number. All invocations of `$millis()` within an evaluation of an expression will all return the same value."
},
"$sum": {
"args": "array",
@@ -136,20 +136,20 @@
"desc": "Appends two arrays"
},
"$sort": {
- "args":"array [, function]",
- "desc":"Returns an array containing all the values in the `array` parameter, but sorted into order.\n\nIf a comparator `function` is supplied, then it must be a function that takes two parameters:\n\n`function(left, right)`\n\nThis function gets invoked by the sorting algorithm to compare two values left and right. If the value of left should be placed after the value of right in the desired sort order, then the function must return Boolean `true` to indicate a swap. Otherwise it must return `false`."
+ "args": "array [, function]",
+ "desc": "Returns an array containing all the values in the `array` parameter, but sorted into order.\n\nIf a comparator `function` is supplied, then it must be a function that takes two parameters:\n\n`function(left, right)`\n\nThis function gets invoked by the sorting algorithm to compare two values left and right. If the value of left should be placed after the value of right in the desired sort order, then the function must return Boolean `true` to indicate a swap. Otherwise it must return `false`."
},
"$reverse": {
- "args":"array",
- "desc":"Returns an array containing all the values from the `array` parameter, but in reverse order."
+ "args": "array",
+ "desc": "Returns an array containing all the values from the `array` parameter, but in reverse order."
},
"$shuffle": {
- "args":"array",
- "desc":"Returns an array containing all the values from the `array` parameter, but shuffled into random order."
+ "args": "array",
+ "desc": "Returns an array containing all the values from the `array` parameter, but shuffled into random order."
},
"$zip": {
- "args":"array, ...",
- "desc":"Returns a convolved (zipped) array containing grouped arrays of values from the `array1` … `arrayN` arguments from index 0, 1, 2...."
+ "args": "array, ...",
+ "desc": "Returns a convolved (zipped) array containing grouped arrays of values from the `array1` … `arrayN` arguments from index 0, 1, 2...."
},
"$keys": {
"args": "object",
@@ -168,24 +168,24 @@
"desc": "Merges an array of `objects` into a single `object` containing all the key/value pairs from each of the objects in the input array. If any of the input objects contain the same key, then the returned `object` will contain the value of the last one in the array. It is an error if the input array contains an item that is not an object."
},
"$sift": {
- "args":"object, function",
- "desc":"Returns an object that contains only the key/value pairs from the `object` parameter that satisfy the predicate `function` passed in as the second parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, key [, object]])`"
+ "args": "object, function",
+ "desc": "Returns an object that contains only the key/value pairs from the `object` parameter that satisfy the predicate `function` passed in as the second parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, key [, object]])`"
},
"$each": {
- "args":"object, function",
- "desc":"Returns an array containing the values return by the `function` when applied to each key/value pair in the `object`."
+ "args": "object, function",
+ "desc": "Returns an array containing the values return by the `function` when applied to each key/value pair in the `object`."
},
"$map": {
- "args":"array, function",
- "desc":"Returns an array containing the results of applying the `function` parameter to each value in the `array` parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`"
+ "args": "array, function",
+ "desc": "Returns an array containing the results of applying the `function` parameter to each value in the `array` parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`"
},
"$filter": {
- "args":"array, function",
- "desc":"Returns an array containing only the values in the `array` parameter that satisfy the `function` predicate.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`"
+ "args": "array, function",
+ "desc": "Returns an array containing only the values in the `array` parameter that satisfy the `function` predicate.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`"
},
"$reduce": {
- "args":"array, function [, init]",
- "desc":"Returns an aggregated value derived from applying the `function` parameter successively to each value in `array` in combination with the result of the previous application of the function.\n\nThe function must accept two arguments, and behaves like an infix operator between each value within the `array`. The signature of `function` must be of the form: `myfunc($accumulator, $value[, $index[, $array]])`\n\nThe optional `init` parameter is used as the initial value in the aggregation."
+ "args": "array, function [, init]",
+ "desc": "Returns an aggregated value derived from applying the `function` parameter successively to each value in `array` in combination with the result of the previous application of the function.\n\nThe function must accept two arguments, and behaves like an infix operator between each value within the `array`. The signature of `function` must be of the form: `myfunc($accumulator, $value[, $index[, $array]])`\n\nThe optional `init` parameter is used as the initial value in the aggregation."
},
"$flowContext": {
"args": "string[, string]",
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 e3a4356191..a9ebae904b 100755
--- a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json
+++ b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json
@@ -193,22 +193,22 @@
"key": "Private Key",
"passphrase": "Passphrase",
"ca": "CA Certificate",
- "verify-server-cert":"Verify server certificate",
+ "verify-server-cert": "Verify server certificate",
"servername": "Server Name",
"alpnprotocol": "ALPN Protocol"
},
"placeholder": {
- "cert":"path to certificate (PEM format)",
- "key":"path to private key (PEM format)",
- "ca":"path to CA certificate (PEM format)",
- "passphrase":"private key passphrase (optional)",
- "servername":"for use with SNI",
- "alpnprotocol":"for use with ALPN"
+ "cert": "path to certificate (PEM format)",
+ "key": "path to private key (PEM format)",
+ "ca": "path to CA certificate (PEM format)",
+ "passphrase": "private key passphrase (optional)",
+ "servername": "for use with SNI",
+ "alpnprotocol": "for use with ALPN"
},
"error": {
"missing-file": "No certificate/key file provided",
- "invalid-cert": "Certificate not specified",
- "invalid-key": "Private key not specified"
+ "invalid-cert": "Certificate not specified",
+ "invalid-key": "Private key not specified"
}
},
"exec": {
@@ -262,10 +262,10 @@
"moduleLoadError": "Failed to load module __module__: __error__",
"moduleNameError": "Invalid module variable name: __name__",
"moduleNameReserved": "Reserved variable name: __name__",
- "inputListener":"Cannot add listener to 'input' event within Function",
- "non-message-returned":"Function tried to send a message of type __type__",
- "invalid-js": "Error in JavaScript code",
- "missing-module": "Module __module__ missing"
+ "inputListener": "Cannot add listener to 'input' event within Function",
+ "non-message-returned": "Function tried to send a message of type __type__",
+ "invalid-js": "Error in JavaScript code",
+ "missing-module": "Module __module__ missing"
}
},
"template": {
@@ -319,35 +319,35 @@
"limit": "limit",
"limitTopic": "limit topic",
"random": "random",
- "rate": "rate",
- "random-first": "first random value",
- "random-last": "last random value",
- "units" : {
+ "rate": "rate",
+ "random-first": "first random value",
+ "random-last": "last random value",
+ "units": {
"second": {
- "plural" : "Seconds",
+ "plural": "Seconds",
"singular": "Second"
},
"minute": {
- "plural" : "Minutes",
+ "plural": "Minutes",
"singular": "Minute"
},
"hour": {
- "plural" : "Hours",
+ "plural": "Hours",
"singular": "Hour"
},
"day": {
- "plural" : "Days",
+ "plural": "Days",
"singular": "Day"
}
}
},
"errors": {
- "too-many" : "too many pending messages in delay node",
- "invalid-timeout": "Invalid delay value",
- "invalid-rate": "Invalid rate value",
- "invalid-rate-unit": "Invalid rate unit value",
- "invalid-random-first": "Invalid first random value",
- "invalid-random-last": "Invalid last random value"
+ "too-many": "too many pending messages in delay node",
+ "invalid-timeout": "Invalid delay value",
+ "invalid-rate": "Invalid rate value",
+ "invalid-rate-unit": "Invalid rate unit value",
+ "invalid-random-first": "Invalid first random value",
+ "invalid-random-last": "Invalid last random value"
}
},
"trigger": {
@@ -382,11 +382,11 @@
"trigger-block": "trigger & block",
"trigger-loop": "resend every",
"reset": "Reset the trigger if:",
- "resetMessage":"msg.reset is set",
- "resetPayload":"msg.payload equals",
+ "resetMessage": "msg.reset is set",
+ "resetPayload": "msg.payload equals",
"resetprompt": "optional",
- "duration": "duration",
- "topic": "topic"
+ "duration": "duration",
+ "topic": "topic"
}
},
"comment": {
@@ -411,8 +411,8 @@
"cleansession": "Use clean session",
"cleanstart": "Use clean start",
"use-tls": "Use TLS",
- "tls-config":"TLS Configuration",
- "verify-server-cert":"Verify server certificate",
+ "tls-config": "TLS Configuration",
+ "verify-server-cert": "Verify server certificate",
"compatmode": "Use legacy MQTT 3.1 support",
"userProperties": "User Properties",
"subscriptionIdentifier": "Subscription ID",
@@ -447,10 +447,10 @@
"auto-connect": "Connect automatically",
"auto-mode-depreciated": "This option is depreciated. Please use the new auto-detect mode."
},
- "sections-label":{
+ "sections-label": {
"birth-message": "Message sent on connection (birth message)",
- "will-message":"Message sent on an unexpected disconnection (will message)",
- "close-message":"Message sent before disconnecting (close message)"
+ "will-message": "Message sent on an unexpected disconnection (will message)",
+ "close-message": "Message sent before disconnecting (close message)"
},
"tabs-label": {
"connection": "Connection",
@@ -459,7 +459,7 @@
},
"placeholder": {
"clientid": "Leave blank for auto generated",
- "clientid-nonclean":"Must be set for non-clean sessions",
+ "clientid-nonclean": "Must be set for non-clean sessions",
"will-topic": "Leave blank to disable will message",
"birth-topic": "Leave blank to disable birth message",
"close-topic": "Leave blank to disable close message"
@@ -492,8 +492,7 @@
"invalid-action-action": "Invalid action specified",
"invalid-action-alreadyconnected": "Disconnect from broker before connecting",
"invalid-action-badsubscription": "msg.topic is missing or invalid",
- "invalid-client-id": "Missing Client ID"
-
+ "invalid-client-id": "Missing Client ID"
}
},
"httpin": {
@@ -506,7 +505,7 @@
"status": "Status code",
"headers": "Headers",
"other": "other",
- "paytoqs" : {
+ "paytoqs": {
"ignore": "Ignore",
"query": "Append to query-string parameters",
"body": "Send as request body"
@@ -520,7 +519,7 @@
"setby": "- set by msg.method -",
"basicauth": "Use authentication",
"use-tls": "Enable secure (SSL/TLS) connection",
- "tls-config":"TLS Configuration",
+ "tls-config": "TLS Configuration",
"basic": "basic authentication",
"digest": "digest authentication",
"bearer": "bearer authentication",
@@ -545,8 +544,8 @@
"no-response": "No response object",
"json-error": "JSON parse error",
"no-url": "No url specified",
- "deprecated-call":"Deprecated call to __method__",
- "invalid-transport":"non-http transport requested",
+ "deprecated-call": "Deprecated call to __method__",
+ "invalid-transport": "non-http transport requested",
"timeout-isnan": "Timeout value is not a valid number, ignoring",
"timeout-isnegative": "Timeout value is negative, ignoring",
"invalid-payload": "Invalid payload",
@@ -584,8 +583,8 @@
"send-error": "An error occurred while sending: ",
"missing-conf": "Missing server configuration",
"duplicate-path": "Cannot have two WebSocket listeners on the same path: __path__",
- "missing-server": "Missing server configuration",
- "missing-client": "Missing client configuration"
+ "missing-server": "Missing server configuration",
+ "missing-client": "Missing client configuration"
}
},
"watch": {
@@ -645,7 +644,6 @@
"connection-closed": "connection closed from __host__:__port__",
"connections": "__count__ connection",
"connections_plural": "__count__ connections"
-
},
"errors": {
"connection-lost": "connection lost to __host__:__port__",
@@ -657,8 +655,8 @@
"connect-timeout": "connect timeout",
"connect-fail": "connect failed",
"bad-string": "failed to convert to string",
- "invalid-host": "Invalid host",
- "invalid-port": "Invalid port"
+ "invalid-host": "Invalid host",
+ "invalid-port": "Invalid port"
}
},
"udp": {
@@ -673,7 +671,7 @@
"toport": "to port",
"address": "Address",
"decode-base64": "Decode Base64 encoded payload?",
- "port": "port"
+ "port": "port"
},
"placeholder": {
"interface": "(optional) local interface or address to bind to",
@@ -721,7 +719,7 @@
"port-invalid": "udp: port number not valid",
"alreadyused": "udp: port __port__ already in use",
"ifnotfound": "udp: interface __iface__ not found",
- "invalid-group": "invalid multicast group"
+ "invalid-group": "invalid multicast group"
}
},
"switch": {
@@ -730,8 +728,8 @@
"property": "Property",
"rule": "rule",
"repair": "recreate message sequences",
- "value-rules": "value rules",
- "sequence-rules": "sequence rules"
+ "value-rules": "value rules",
+ "sequence-rules": "sequence rules"
},
"previous": "previous value",
"and": "and",
@@ -788,8 +786,8 @@
"invalid-json": "Invalid 'to' JSON property",
"invalid-expr": "Invalid JSONata expression: __error__",
"no-override": "Cannot set property of non-object type: __property__",
- "invalid-prop": "Invalid property expression: __property__",
- "invalid-json-data": "Invalid JSON data: __error__"
+ "invalid-prop": "Invalid property expression: __property__",
+ "invalid-json-data": "Invalid JSON data: __error__"
}
},
"range": {
@@ -801,10 +799,10 @@
"from": "from",
"to": "to",
"roundresult": "Round result to the nearest integer?",
- "minin": "input from",
- "maxin": "input to",
- "minout": "target from",
- "maxout": "target to"
+ "minin": "input from",
+ "maxin": "input to",
+ "minout": "target from",
+ "maxout": "target to"
},
"placeholder": {
"min": "e.g. 0",
@@ -901,8 +899,8 @@
"property": "Property",
"actions": {
"toggle": "Convert between JSON String & Object",
- "str":"Always convert to JSON String",
- "obj":"Always convert to JavaScript Object"
+ "str": "Always convert to JSON String",
+ "obj": "Always convert to JavaScript Object"
}
}
},
@@ -988,15 +986,15 @@
},
"split": {
"split": "split",
- "intro":"Split msg.payload based on type:",
- "object":"Object",
- "objectSend":"Send a message for each key/value pair",
- "strBuff":"String / Buffer",
- "array":"Array",
- "splitUsing":"Split using",
- "splitLength":"Fixed length of",
- "stream":"Handle as a stream of messages",
- "addname":" Copy key to "
+ "intro": "Split msg.payload based on type:",
+ "object": "Object",
+ "objectSend": "Send a message for each key/value pair",
+ "strBuff": "String / Buffer",
+ "array": "Array",
+ "splitUsing": "Split using",
+ "splitLength": "Fixed length of",
+ "stream": "Handle as a stream of messages",
+ "addname": " Copy key to "
},
"join": {
"join": "join",
@@ -1029,7 +1027,7 @@
"complete": "After a message with the msg.complete property set",
"tip": "This mode assumes this node is either paired with a split node or the received messages will have a properly configured msg.parts property.",
"too-many": "too many pending messages in join node",
- "message-prop": "message property",
+ "message-prop": "message property",
"merge": {
"topics-label": "Merged Topics",
"topics": "topics",
@@ -1048,51 +1046,51 @@
"invalid-type": "Cannot join __error__ to buffer"
}
},
- "sort" : {
+ "sort": {
"sort": "sort",
- "target" : "Sort",
- "seq" : "message sequence",
- "key" : "Key",
- "elem" : "element value",
- "order" : "Order",
- "ascending" : "ascending",
- "descending" : "descending",
- "as-number" : "as number",
- "invalid-exp" : "Invalid JSONata expression in sort node: __message__",
- "too-many" : "Too many pending messages in sort node",
- "clear" : "clear pending message in sort node"
+ "target": "Sort",
+ "seq": "message sequence",
+ "key": "Key",
+ "elem": "element value",
+ "order": "Order",
+ "ascending": "ascending",
+ "descending": "descending",
+ "as-number": "as number",
+ "invalid-exp": "Invalid JSONata expression in sort node: __message__",
+ "too-many": "Too many pending messages in sort node",
+ "clear": "clear pending message in sort node"
},
- "batch" : {
+ "batch": {
"batch": "batch",
"mode": {
- "label" : "Mode",
- "num-msgs" : "Group by number of messages",
- "interval" : "Group by time interval",
- "concat" : "Concatenate sequences"
+ "label": "Mode",
+ "num-msgs": "Group by number of messages",
+ "interval": "Group by time interval",
+ "concat": "Concatenate sequences"
},
"count": {
- "label" : "Number of messages",
- "overlap" : "Overlap",
- "count" : "count",
- "invalid" : "Invalid count and overlap"
+ "label": "Number of messages",
+ "overlap": "Overlap",
+ "count": "count",
+ "invalid": "Invalid count and overlap"
},
"interval": {
- "label" : "Interval",
- "seconds" : "seconds",
- "empty" : "send empty message when no message arrives"
+ "label": "Interval",
+ "seconds": "seconds",
+ "empty": "send empty message when no message arrives"
},
"concat": {
"topics-label": "Topics",
- "topic" : "topic"
- },
- "too-many" : "too many pending messages in batch node",
- "unexpected" : "unexpected mode",
- "no-parts" : "no parts property in message",
- "error": {
- "invalid-count": "Invalid count",
- "invalid-overlap": "Invalid overlap",
- "invalid-interval": "Invalid interval"
- }
+ "topic": "topic"
+ },
+ "too-many": "too many pending messages in batch node",
+ "unexpected": "unexpected mode",
+ "no-parts": "no parts property in message",
+ "error": {
+ "invalid-count": "Invalid count",
+ "invalid-overlap": "Invalid overlap",
+ "invalid-interval": "Invalid interval"
+ }
},
"rbe": {
"rbe": "filter",
@@ -1102,11 +1100,11 @@
"start": "Start value",
"name": "Name",
"septopics": "Apply mode separately for each ",
- "gap": "value change",
- "property": "property",
- "topic": "topic"
+ "gap": "value change",
+ "property": "property",
+ "topic": "topic"
},
- "placeholder":{
+ "placeholder": {
"bandgap": "e.g. 10 or 5%",
"start": "leave blank to use first data received"
},
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 cb2e08aab2..3b46d0c9f0 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
@@ -8,7 +8,6 @@
"httpStatic": "HTTP Static : __path__"
}
},
-
"server": {
"loading": "Loading palette nodes",
"palette-editor": {
@@ -61,7 +60,6 @@
"function-required": "httpsRefreshInterval requires https property to be a function"
}
},
-
"api": {
"flows": {
"error-save": "Error saving flows: __message__",
@@ -79,18 +77,16 @@
"error-enable": "Failed to enable node:"
}
},
-
"comms": {
"error": "Communication channel error: __message__",
"error-server": "Communication server error: __message__",
"error-send": "Communication send error: __message__"
},
-
"settings": {
"user-not-available": "Cannot save user settings: __message__",
"not-available": "Settings not available",
"property-read-only": "Property '__prop__' is read-only",
- "readonly-mode" : "Runtime in read-only mode. Changes will not be saved."
+ "readonly-mode": "Runtime in read-only mode. Changes will not be saved."
},
"library": {
"unknownLibrary": "Unknown library: __library__",
@@ -101,12 +97,12 @@
},
"nodes": {
"credentials": {
- "error":"Error loading credentials: __message__",
- "error-saving":"Error saving credentials: __message__",
+ "error": "Error loading credentials: __message__",
+ "error-saving": "Error saving credentials: __message__",
"not-registered": "Credential type '__type__' is not registered",
"system-key-warning": "\n\n---------------------------------------------------------------------\nYour flow credentials file is encrypted using a system-generated key.\n\nIf the system-generated key is lost for any reason, your credentials\nfile will not be recoverable, you will have to delete it and re-enter\nyour credentials.\n\nYou should set your own key using the 'credentialSecret' option in\nyour settings file. Node-RED will then re-encrypt your credentials\nfile using your chosen key the next time you deploy a change.\n---------------------------------------------------------------------\n",
- "unencrypted" : "Using unencrypted credentials",
- "encryptedNotFound" : "Encrypted credentials not found"
+ "unencrypted": "Using unencrypted credentials",
+ "encryptedNotFound": "Encrypted credentials not found"
},
"flows": {
"safe-mode": "Flows stopped in safe mode. Deploy to start.",
@@ -150,7 +146,6 @@
}
}
},
-
"storage": {
"index": {
"forbidden-flow-name": "forbidden flow name"
@@ -180,7 +175,6 @@
}
}
},
-
"context": {
"log-store-init": "Context store : '__name__' [__info__]",
"error-loading-module": "Error loading context store: __message__",
@@ -195,5 +189,4 @@
"error-write": "Error writing context: __message__"
}
}
-
}
From dda84c5cd5f2f36a44ae7754f4324037619c6b39 Mon Sep 17 00:00:00 2001
From: Kazuhito Yokoi
Date: Sun, 22 May 2022 11:18:40 +0900
Subject: [PATCH 03/53] Fix indents in other code except message catalog
---
.../editor-client/src/sass/jquery.scss | 4 +-
.../@node-red/nodes/core/common/21-debug.html | 2 +-
packages/node_modules/node-red/settings.js | 148 +++++++++---------
3 files changed, 77 insertions(+), 77 deletions(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss b/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss
index a884d66416..b7278b332e 100644
--- a/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss
+++ b/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss
@@ -27,10 +27,10 @@
}
.ui-widget.ui-widget-content {
- border: 1px solid $tertiary-border-color;
+ border: 1px solid $tertiary-border-color;
}
.ui-widget-content {
- border: 1px solid $secondary-border-color;
+ border: 1px solid $secondary-border-color;
}
.ui-widget-header {
diff --git a/packages/node_modules/@node-red/nodes/core/common/21-debug.html b/packages/node_modules/@node-red/nodes/core/common/21-debug.html
index 51e47e2f2d..62da1b2593 100644
--- a/packages/node_modules/@node-red/nodes/core/common/21-debug.html
+++ b/packages/node_modules/@node-red/nodes/core/common/21-debug.html
@@ -499,7 +499,7 @@
types:['msg', fullType, "jsonata"],
typeField: $("#node-input-targetType")
});
- if (this.targetType === "jsonata") {
+ if (this.targetType === "jsonata") {
var property = this.complete || "";
$("#node-input-typed-complete").typedInput('type','jsonata');
$("#node-input-typed-complete").typedInput('value',property);
diff --git a/packages/node_modules/node-red/settings.js b/packages/node_modules/node-red/settings.js
index 2e2b7035ec..d8f8798518 100644
--- a/packages/node_modules/node-red/settings.js
+++ b/packages/node_modules/node-red/settings.js
@@ -249,18 +249,18 @@ module.exports = {
* - externalModules
******************************************************************************/
- /** Uncomment the following to run node-red in your preferred language.
- * Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko
- * Some languages are more complete than others.
- */
- // lang: "de",
+ /** Uncomment the following to run node-red in your preferred language.
+ * Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko
+ * Some languages are more complete than others.
+ */
+ // lang: "de",
/** Configure diagnostics options
* - enabled: When `enabled` is `true` (or unset), diagnostics data will
* be available at http://localhost:1880/diagnostics
* - ui: When `ui` is `true` (or unset), the action `show-system-info` will
* be available to logged in users of node-red editor
- */
+ */
diagnostics: {
/** enable or disable diagnostics endpoint. Must be set to `false` to disable */
enabled: true,
@@ -268,74 +268,74 @@ module.exports = {
ui: true,
},
- /** Configure the logging output */
- logging: {
- /** Only console logging is currently supported */
- console: {
- /** Level of logging to be recorded. Options are:
- * fatal - only those errors which make the application unusable should be recorded
- * error - record errors which are deemed fatal for a particular request + fatal errors
- * warn - record problems which are non fatal + errors + fatal errors
- * info - record information about the general running of the application + warn + error + fatal errors
- * debug - record information which is more verbose than info + info + warn + error + fatal errors
- * trace - record very detailed logging + debug + info + warn + error + fatal errors
- * off - turn off all logging (doesn't affect metrics or audit)
- */
- level: "info",
- /** Whether or not to include metric events in the log output */
- metrics: false,
- /** Whether or not to include audit events in the log output */
- audit: false
- }
- },
-
- /** Context Storage
- * The following property can be used to enable context storage. The configuration
- * provided here will enable file-based context that flushes to disk every 30 seconds.
- * Refer to the documentation for further options: https://nodered.org/docs/api/context/
- */
- //contextStorage: {
- // default: {
- // module:"localfilesystem"
- // },
- //},
-
- /** `global.keys()` returns a list of all properties set in global context.
- * This allows them to be displayed in the Context Sidebar within the editor.
- * In some circumstances it is not desirable to expose them to the editor. The
- * following property can be used to hide any property set in `functionGlobalContext`
- * from being list by `global.keys()`.
- * By default, the property is set to false to avoid accidental exposure of
- * their values. Setting this to true will cause the keys to be listed.
- */
- exportGlobalContextKeys: false,
-
- /** Configure how the runtime will handle external npm modules.
- * This covers:
- * - whether the editor will allow new node modules to be installed
- * - whether nodes, such as the Function node are allowed to have their
- * own dynamically configured dependencies.
- * The allow/denyList options can be used to limit what modules the runtime
- * will install/load. It can use '*' as a wildcard that matches anything.
- */
- externalModules: {
- // autoInstall: false, /** Whether the runtime will attempt to automatically install missing modules */
- // autoInstallRetry: 30, /** Interval, in seconds, between reinstall attempts */
- // palette: { /** Configuration for the Palette Manager */
- // allowInstall: true, /** Enable the Palette Manager in the editor */
- // allowUpdate: true, /** Allow modules to be updated in the Palette Manager */
- // allowUpload: true, /** Allow module tgz files to be uploaded and installed */
- // allowList: ['*'],
- // denyList: [],
- // allowUpdateList: ['*'],
- // denyUpdateList: []
- // },
- // modules: { /** Configuration for node-specified modules */
- // allowInstall: true,
- // allowList: [],
- // denyList: []
- // }
- },
+ /** Configure the logging output */
+ logging: {
+ /** Only console logging is currently supported */
+ console: {
+ /** Level of logging to be recorded. Options are:
+ * fatal - only those errors which make the application unusable should be recorded
+ * error - record errors which are deemed fatal for a particular request + fatal errors
+ * warn - record problems which are non fatal + errors + fatal errors
+ * info - record information about the general running of the application + warn + error + fatal errors
+ * debug - record information which is more verbose than info + info + warn + error + fatal errors
+ * trace - record very detailed logging + debug + info + warn + error + fatal errors
+ * off - turn off all logging (doesn't affect metrics or audit)
+ */
+ level: "info",
+ /** Whether or not to include metric events in the log output */
+ metrics: false,
+ /** Whether or not to include audit events in the log output */
+ audit: false
+ }
+ },
+
+ /** Context Storage
+ * The following property can be used to enable context storage. The configuration
+ * provided here will enable file-based context that flushes to disk every 30 seconds.
+ * Refer to the documentation for further options: https://nodered.org/docs/api/context/
+ */
+ //contextStorage: {
+ // default: {
+ // module:"localfilesystem"
+ // },
+ //},
+
+ /** `global.keys()` returns a list of all properties set in global context.
+ * This allows them to be displayed in the Context Sidebar within the editor.
+ * In some circumstances it is not desirable to expose them to the editor. The
+ * following property can be used to hide any property set in `functionGlobalContext`
+ * from being list by `global.keys()`.
+ * By default, the property is set to false to avoid accidental exposure of
+ * their values. Setting this to true will cause the keys to be listed.
+ */
+ exportGlobalContextKeys: false,
+
+ /** Configure how the runtime will handle external npm modules.
+ * This covers:
+ * - whether the editor will allow new node modules to be installed
+ * - whether nodes, such as the Function node are allowed to have their
+ * own dynamically configured dependencies.
+ * The allow/denyList options can be used to limit what modules the runtime
+ * will install/load. It can use '*' as a wildcard that matches anything.
+ */
+ externalModules: {
+ // autoInstall: false, /** Whether the runtime will attempt to automatically install missing modules */
+ // autoInstallRetry: 30, /** Interval, in seconds, between reinstall attempts */
+ // palette: { /** Configuration for the Palette Manager */
+ // allowInstall: true, /** Enable the Palette Manager in the editor */
+ // allowUpdate: true, /** Allow modules to be updated in the Palette Manager */
+ // allowUpload: true, /** Allow module tgz files to be uploaded and installed */
+ // allowList: ['*'],
+ // denyList: [],
+ // allowUpdateList: ['*'],
+ // denyUpdateList: []
+ // },
+ // modules: { /** Configuration for node-specified modules */
+ // allowInstall: true,
+ // allowList: [],
+ // denyList: []
+ // }
+ },
/*******************************************************************************
From 6182e22d1868b5fdea18bdb6bfec2c276df9af08 Mon Sep 17 00:00:00 2001
From: Kazuhito Yokoi
Date: Sun, 22 May 2022 11:56:21 +0900
Subject: [PATCH 04/53] Add string label to typedInput in file nodes
---
.../node_modules/@node-red/nodes/core/storage/10-file.html | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/packages/node_modules/@node-red/nodes/core/storage/10-file.html b/packages/node_modules/@node-red/nodes/core/storage/10-file.html
index ddddcb6874..69e91e3c50 100755
--- a/packages/node_modules/@node-red/nodes/core/storage/10-file.html
+++ b/packages/node_modules/@node-red/nodes/core/storage/10-file.html
@@ -237,7 +237,8 @@
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
default: "msg",
- types:[{ value: "str", label:"", icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
+ types:[{ value: "str", label: RED._("common.type.string"),
+ icon: "red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {
@@ -342,7 +343,8 @@
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
default: "msg",
- types:[{ value: "str", label:"", icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
+ types:[{ value: "str", label: RED._("common.type.string"),
+ icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {
From bc80569fe9711f0407583f26a236a208c30d8c0b Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Sun, 22 May 2022 17:59:27 +0900
Subject: [PATCH 05/53] fix buffer parse error message of evaluateNodeProperty
---
packages/node_modules/@node-red/util/lib/util.js | 7 ++++++-
test/unit/@node-red/util/lib/util_spec.js | 13 +++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/packages/node_modules/@node-red/util/lib/util.js b/packages/node_modules/@node-red/util/lib/util.js
index a6fec8f98b..d82de0d1d0 100644
--- a/packages/node_modules/@node-red/util/lib/util.js
+++ b/packages/node_modules/@node-red/util/lib/util.js
@@ -641,7 +641,12 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
result = Date.now();
} else if (type === 'bin') {
var data = JSON.parse(value);
- result = Buffer.from(data);
+ if (Array.isArray(data) || (typeof(data) === "string")) {
+ result = Buffer.from(data);
+ }
+ else {
+ throw createError("INVALID_BUFFER_DATA", "Not string or array");
+ }
} else if (type === 'msg' && msg) {
try {
result = getMessageProperty(msg,value);
diff --git a/test/unit/@node-red/util/lib/util_spec.js b/test/unit/@node-red/util/lib/util_spec.js
index 2013f143e8..3bab2739a5 100644
--- a/test/unit/@node-red/util/lib/util_spec.js
+++ b/test/unit/@node-red/util/lib/util_spec.js
@@ -388,6 +388,19 @@ describe("@node-red/util/util", function() {
result[0].should.eql(1);
result[1].should.eql(2);
});
+ it('throws an error if buffer data is not array or string', function (done) {
+ try {
+ var result = util.evaluateNodeProperty('12','bin');
+ done("should throw an error");
+ } catch (err) {
+ if (err.code === "INVALID_BUFFER_DATA") {
+ done();
+ }
+ else {
+ done("should throw an error");
+ }
+ }
+ });
it('returns msg property',function() {
var result = util.evaluateNodeProperty('foo.bar','msg',{},{foo:{bar:"123"}});
result.should.eql("123");
From f424f07e54a0e6bb16d1a923ad8ea628d7de362e Mon Sep 17 00:00:00 2001
From: Kazuhito Yokoi
Date: Wed, 25 May 2022 22:56:58 +0900
Subject: [PATCH 06/53] Fix typos in message catalog
---
.../@node-red/editor-client/locales/ja/infotips.json | 2 +-
.../node_modules/@node-red/nodes/locales/en-US/messages.json | 2 +-
packages/node_modules/@node-red/nodes/locales/ja/messages.json | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
mode change 100755 => 100644 packages/node_modules/@node-red/nodes/locales/en-US/messages.json
diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json b/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json
index 45ba8450eb..14459fa100 100644
--- a/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json
+++ b/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json
@@ -17,7 +17,7 @@
"tip14": "[shift] を押しながらノードを [click] すると、接続された全てのノードを選択できます。",
"tip15": "[ctrl] を押しながらノードを [click] すると、選択/非選択を切り替えできます。",
"tip16": "{{core:show-previous-tab}} や {{core:show-next-tab}} で、タブの切り替えができます。",
- "tip17": "ノードのプロバティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。",
+ "tip17": "ノードのプロパティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。",
"tip18": "ノードを選択し、 {{core:edit-selected-node}} を押すとプロパティ設定画面が表示されます。"
}
}
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
old mode 100755
new mode 100644
index f077e14309..77d832abde
--- a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json
+++ b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json
@@ -137,7 +137,7 @@
"toConsole": "system console",
"toStatus": "node status (32 characters)",
"severity": "Level",
- "node": "node",
+ "node": "node",
"notification": {
"activated": "Successfully activated: __label__",
"deactivated": "Successfully deactivated: __label__"
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 d9f5ee4a43..c508a3e766 100644
--- a/packages/node_modules/@node-red/nodes/locales/ja/messages.json
+++ b/packages/node_modules/@node-red/nodes/locales/ja/messages.json
@@ -137,7 +137,7 @@
"toConsole": "システムコンソール",
"toStatus": "ノードステータス(32 文字)",
"severity": "Level",
- "node": "ノード",
+ "node": "ノード",
"notification": {
"activated": "有効化しました: __label__",
"deactivated": "無効化しました: __label__"
From 121372802f41bd333b9b52f8f3e90affa6cd940a Mon Sep 17 00:00:00 2001
From: Kazuhito Yokoi
Date: Thu, 26 May 2022 22:50:52 +0900
Subject: [PATCH 07/53] Use built-in type in typedInput
---
.../node_modules/@node-red/nodes/core/storage/10-file.html | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/packages/node_modules/@node-red/nodes/core/storage/10-file.html b/packages/node_modules/@node-red/nodes/core/storage/10-file.html
index 69e91e3c50..b726b537de 100755
--- a/packages/node_modules/@node-red/nodes/core/storage/10-file.html
+++ b/packages/node_modules/@node-red/nodes/core/storage/10-file.html
@@ -237,8 +237,7 @@
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
default: "msg",
- types:[{ value: "str", label: RED._("common.type.string"),
- icon: "red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
+ types: ["str", "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {
@@ -343,8 +342,7 @@
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
default: "msg",
- types:[{ value: "str", label: RED._("common.type.string"),
- icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
+ types: ["str", "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {
From 7fbebbf3611050aeb74a1aa61f5e16c912d65713 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Fri, 27 May 2022 11:44:56 +0900
Subject: [PATCH 08/53] fix JSONata evaluation of inject button
---
.../node_modules/@node-red/nodes/core/common/20-inject.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/packages/node_modules/@node-red/nodes/core/common/20-inject.js b/packages/node_modules/@node-red/nodes/core/common/20-inject.js
index 92b8122df9..734bce765b 100644
--- a/packages/node_modules/@node-red/nodes/core/common/20-inject.js
+++ b/packages/node_modules/@node-red/nodes/core/common/20-inject.js
@@ -109,9 +109,10 @@ module.exports = function(RED) {
if (!property) return;
if (valueType === "jsonata") {
- if (p.exp) {
+ if (p.v) {
try {
- var val = RED.util.evaluateJSONataExpression(p.exp, msg);
+ var exp = RED.util.prepareJSONataExpression(p.v, node);
+ var val = RED.util.evaluateJSONataExpression(exp, msg);
RED.util.setMessageProperty(msg, property, val, true);
}
catch (err) {
From 7e6dfa7b927a513dea3c28beabc6b760e078748e Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Fri, 27 May 2022 12:11:53 +0900
Subject: [PATCH 09/53] update test for inject node
---
test/nodes/core/common/20-inject_spec.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/nodes/core/common/20-inject_spec.js b/test/nodes/core/common/20-inject_spec.js
index cb14690d0e..a4dbdd9e46 100644
--- a/test/nodes/core/common/20-inject_spec.js
+++ b/test/nodes/core/common/20-inject_spec.js
@@ -906,6 +906,7 @@ describe('inject node', function() {
msg.should.have.property("str1", "1"); //injected prop
msg.should.have.property("num1", 1); //injected prop
msg.should.have.property("bool1", true); //injected prop
+ msg.should.have.property("jsonata1", "AB"); //injected prop
helper.clearFlows().then(function() {
done();
@@ -919,6 +920,7 @@ describe('inject node', function() {
{p:"str1", v:"1", vt:"str"}, //new prop
{p:"num1", v:"1", vt:"num"}, //new prop
{p:"bool1", v:"true", vt:"bool"}, //new prop
+ {p:"jsonata1", v:'"A" & "B"', vt:"jsonata"}, //new prop
]})
.expect(200).end(function(err) {
if (err) {
From 50e3da084973b444e37684fbc353be707e0082e3 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Sat, 28 May 2022 20:16:53 +0900
Subject: [PATCH 10/53] fix new folder menu of save to library dialog
---
.../editor-client/src/js/ui/library.js | 200 +++++++++---------
1 file changed, 103 insertions(+), 97 deletions(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/library.js b/packages/node_modules/@node-red/editor-client/src/js/ui/library.js
index ee176dee27..d276b1572c 100755
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/library.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/library.js
@@ -363,106 +363,112 @@ RED.library = (function() {
options.onconfirm(item);
}
});
- var itemTools = $("
").css({position: "absolute",bottom:"6px",right:"8px"});
- var menuButton = $('')
- .on("click", function(evt) {
- evt.preventDefault();
- evt.stopPropagation();
- var elementPos = menuButton.offset();
-
- var menuOptionMenu = RED.menu.init({id:"red-ui-library-browser-menu",
- options: [
- {id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() {
- var defaultFolderName = "new-folder";
- var defaultFolderNameMatches = {};
-
- var selected = dirList.treeList('selected');
- if (!selected.children) {
- selected = selected.parent;
- }
- var complete = function() {
- selected.children.forEach(function(c) {
- if (/^new-folder/.test(c.label)) {
- defaultFolderNameMatches[c.label] = true
- }
- });
- var folderIndex = 2;
- while(defaultFolderNameMatches[defaultFolderName]) {
- defaultFolderName = "new-folder-"+(folderIndex++)
- }
-
- selected.treeList.expand();
- var input = $('').val(defaultFolderName);
- var newItem = {
- icon: "fa fa-folder-o",
- children:[],
- path: selected.path,
- element: input
- }
- var confirmAdd = function() {
- var val = input.val().trim();
- if (val === "") {
- cancelAdd();
- return;
- } else {
- for (var i=0;i").css({position: "absolute",bottom:"6px",right:"8px"});
+ var menuButton = $('')
+ .on("click", function(evt) {
+ evt.preventDefault();
+ evt.stopPropagation();
+ var elementPos = menuButton.offset();
+
+ var menuOptionMenu
+ = RED.menu.init({id:"red-ui-library-browser-menu",
+ options: [
+ {id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() {
+ var defaultFolderName = "new-folder";
+ var defaultFolderNameMatches = {};
+
+ var selected = dirList.treeList('selected');
+ if (!selected.children) {
+ selected = selected.parent;
+ }
+ var complete = function() {
+ selected.children.forEach(function(c) {
+ if (/^new-folder/.test(c.label)) {
+ defaultFolderNameMatches[c.label] = true
+ }
+ });
+ var folderIndex = 2;
+ while(defaultFolderNameMatches[defaultFolderName]) {
+ defaultFolderName = "new-folder-"+(folderIndex++)
+ }
+
+ selected.treeList.expand();
+ var input = $('').val(defaultFolderName);
+ var newItem = {
+ icon: "fa fa-folder-o",
+ children:[],
+ path: selected.path,
+ element: input
+ }
+ var confirmAdd = function() {
+ var val = input.val().trim();
+ if (val === "") {
+ cancelAdd();
+ return;
+ } else {
+ for (var i=0;i
Date: Wed, 8 Jun 2022 09:36:32 +0900
Subject: [PATCH 11/53] place node dragged from palette within workspace
---
.../@node-red/editor-client/src/js/ui/view.js | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
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 adab87e383..a15ec32f4d 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
@@ -526,6 +526,23 @@ RED.view = (function() {
nn.x = mousePos[0];
nn.y = mousePos[1];
+ var minX = nn.w/2 -5;
+ if (nn.x < minX) {
+ nn.x = minX;
+ }
+ var minY = nn.h/2 -5;
+ if (nn.y < minY) {
+ nn.y = minY;
+ }
+ var maxX = space_width -nn.w/2 +5;
+ if (nn.x > maxX) {
+ nn.x = maxX;
+ }
+ var maxY = space_height -nn.h +5;
+ if (nn.y > maxY) {
+ nn.y = maxY;
+ }
+
if (snapGrid) {
var gridOffset = RED.view.tools.calculateGridSnapOffsets(nn);
nn.x -= gridOffset.x;
From 3046798ec552d6fbe194521234e44dda20e19292 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Wed, 8 Jun 2022 14:50:14 +0900
Subject: [PATCH 12/53] fix layer of palette node
---
.../node_modules/@node-red/editor-client/src/sass/palette.scss | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/node_modules/@node-red/editor-client/src/sass/palette.scss b/packages/node_modules/@node-red/editor-client/src/sass/palette.scss
index 397dd4765e..800f340790 100644
--- a/packages/node_modules/@node-red/editor-client/src/sass/palette.scss
+++ b/packages/node_modules/@node-red/editor-client/src/sass/palette.scss
@@ -131,6 +131,7 @@
width: 120px;
background-size: contain;
position: relative;
+ z-index: 4;
&:not(.red-ui-palette-node-config):not(.red-ui-palette-node-small):first-child {
margin-top: 15px;
}
From deb9c4ecc098d2cdbecdd777be5a5819ea54dad2 Mon Sep 17 00:00:00 2001
From: Nick O'Leary
Date: Thu, 9 Jun 2022 15:47:16 -0500
Subject: [PATCH 13/53] Reset mouse state when switching tabs Fixes #3639
---
.../@node-red/editor-client/src/js/ui/view.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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 adab87e383..7d4d950f36 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
@@ -385,6 +385,9 @@ RED.view = (function() {
drag_lines = [];
RED.events.on("workspace:change",function(event) {
+ // Just in case the mouse left the workspace whilst doing an action,
+ // put us back into default mode so the refresh works
+ mouse_mode = 0
if (event.old !== 0) {
workspaceScrollPositions[event.old] = {
left:chart.scrollLeft(),
@@ -955,7 +958,7 @@ RED.view = (function() {
}
function canvasMouseDown() {
- if (RED.view.DEBUG) {
+ if (RED.view.DEBUG) {
console.warn("canvasMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event });
}
if (mouse_mode === RED.state.SELECTING_NODE) {
@@ -1719,7 +1722,7 @@ RED.view = (function() {
function canvasMouseUp() {
lastClickPosition = [d3.event.offsetX/scaleFactor,d3.event.offsetY/scaleFactor];
- if (RED.view.DEBUG) {
+ if (RED.view.DEBUG) {
console.warn("canvasMouseUp", { mouse_mode, point: d3.mouse(this), event: d3.event });
}
var i;
@@ -3719,7 +3722,7 @@ RED.view = (function() {
function junctionMouseOutProxy(e) { junctionMouseOut(d3.select(this), this.__data__) }
function linkMouseDown(d) {
- if (RED.view.DEBUG) {
+ if (RED.view.DEBUG) {
console.warn("linkMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event });
}
if (mouse_mode === RED.state.SELECTING_NODE) {
From 64061c3440ca04552b59b4a0885b299e860883bd Mon Sep 17 00:00:00 2001
From: Mauricio Bonani
Date: Thu, 9 Jun 2022 17:44:11 -0400
Subject: [PATCH 14/53] Fix selector placement
---
.../node_modules/@node-red/editor-client/src/sass/panels.scss | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/sass/panels.scss b/packages/node_modules/@node-red/editor-client/src/sass/panels.scss
index 95d9210f48..e820992b42 100644
--- a/packages/node_modules/@node-red/editor-client/src/sass/panels.scss
+++ b/packages/node_modules/@node-red/editor-client/src/sass/panels.scss
@@ -87,8 +87,7 @@
display: inline-block;
cursor: ew-resize;
background-color: $primary-background;
- }
-
+
&:before {
content: '';
display: block;
@@ -104,4 +103,5 @@
mask-repeat: no-repeat;
background-color: $grip-color;
}
+ }
}
From 71a272f0a64c61cbbd3e180f39ad45a0568d8d9c Mon Sep 17 00:00:00 2001
From: Nick O'Leary
Date: Thu, 9 Jun 2022 22:11:48 -0500
Subject: [PATCH 15/53] Fix ESM module loading in Function node Fixes #3627
---
.../@node-red/registry/lib/externalModules.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/packages/node_modules/@node-red/registry/lib/externalModules.js b/packages/node_modules/@node-red/registry/lib/externalModules.js
index ca1e4bfd87..b61392d9b9 100644
--- a/packages/node_modules/@node-red/registry/lib/externalModules.js
+++ b/packages/node_modules/@node-red/registry/lib/externalModules.js
@@ -11,6 +11,7 @@ const exec = require("@node-red/util").exec;
const log = require("@node-red/util").log;
const hooks = require("@node-red/util").hooks;
const url = require("url");
+const { createRequire } = require("module");
const BUILTIN_MODULES = require('module').builtinModules;
@@ -139,10 +140,15 @@ function importModule(module) {
}
const externalModuleDir = getInstallDir();
const moduleDir = path.join(externalModuleDir,"node_modules",module);
+ // To handle both CJS and ESM we need to resolve the module to the
+ // specific file that is loaded when the module is required/imported
+ // As this won't be on the natural module search path, we use createRequire
+ // to access the module
+ const modulePath = createRequire(moduleDir).resolve(module)
// Import needs the full path to the module's main .js file
// It also needs to be a file:// url for Windows
- const moduleFile = url.pathToFileURL(require.resolve(moduleDir));
- return import(moduleFile);
+ const moduleUrl = url.pathToFileURL(modulePath);
+ return import(moduleUrl);
}
function parseModuleName(module) {
From 99d32c475838ea5fcb09810a6867b553025e3af9 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Fri, 10 Jun 2022 20:22:09 +0900
Subject: [PATCH 16/53] sanitize tab name
---
.../@node-red/editor-client/src/js/ui/common/tabs.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 d471d206a6..8901cf11fa 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
@@ -828,7 +828,7 @@ RED.tabs = (function() {
}
// link.attr("title",tab.label);
- RED.popover.tooltip(link,function() { return tab.label})
+ RED.popover.tooltip(link,function() { return RED.utils.sanitize(tab.label); });
if (options.onadd) {
options.onadd(tab);
From 30d88bbe7efcbf72519e18bbbca246de6a5e0484 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Sat, 11 Jun 2022 09:50:28 +0900
Subject: [PATCH 17/53] extend escaped subflow category characters
---
.../node_modules/@node-red/editor-client/src/js/ui/palette.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js
index 1e23d578a4..9f20cc6743 100755
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js
@@ -208,7 +208,7 @@ RED.palette = (function() {
}
function escapeCategory(category) {
- return category.replace(/[ /.]/g,"_");
+ return category.replace(/[\x00-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]/g,"_");
}
function addNodeType(nt,def) {
if (getPaletteNode(nt).length) {
From 3e717862a4eed98547d4aa3468e116e8d1a91d2c Mon Sep 17 00:00:00 2001
From: Kazuhito Yokoi
Date: Sat, 11 Jun 2022 20:52:58 +0900
Subject: [PATCH 18/53] Fix z-index value for shade to cover nodes in palette
---
.../node_modules/@node-red/editor-client/src/sass/base.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/sass/base.scss b/packages/node_modules/@node-red/editor-client/src/sass/base.scss
index c22a1d606a..a08e752d43 100644
--- a/packages/node_modules/@node-red/editor-client/src/sass/base.scss
+++ b/packages/node_modules/@node-red/editor-client/src/sass/base.scss
@@ -44,7 +44,7 @@ body {
#red-ui-palette-shade, #red-ui-editor-shade, #red-ui-header-shade, #red-ui-sidebar-shade {
@include shade;
- z-index: 2;
+ z-index: 5;
}
#red-ui-sidebar-shade {
left: -8px;
From 7eed9c0584c37eaac1dc0a73780389d30842075e Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Sun, 12 Jun 2022 10:08:13 +0900
Subject: [PATCH 19/53] include junction to exported nodes
---
.../node_modules/@node-red/editor-client/src/js/ui/clipboard.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/clipboard.js b/packages/node_modules/@node-red/editor-client/src/js/ui/clipboard.js
index 4906f68a12..f547203d46 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/clipboard.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/clipboard.js
@@ -709,6 +709,7 @@ RED.clipboard = (function() {
} else if (type === 'flow') {
var activeWorkspace = RED.workspaces.active();
nodes = RED.nodes.groups(activeWorkspace);
+ nodes = nodes.concat(RED.nodes.junctions(activeWorkspace));
nodes = nodes.concat(RED.nodes.filterNodes({z:activeWorkspace}));
RED.nodes.eachConfig(function(n) {
if (n.z === RED.workspaces.active() && n._def.hasUsers === false) {
From 94471b6d07854ec1775cf6a2d1541ad3912b4ab1 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Mon, 13 Jun 2022 08:47:41 +0900
Subject: [PATCH 20/53] fix conversion of junction to subflow
---
.../@node-red/editor-client/src/js/nodes.js | 36 +++++++++++++++++++
.../editor-client/src/js/ui/subflow.js | 16 ++++++---
2 files changed, 48 insertions(+), 4 deletions(-)
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 de6d5a2d84..ab31e50385 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
@@ -738,6 +738,10 @@ RED.nodes = (function() {
moveGroupToTab(node,z);
return;
}
+ if (node.type === "junction") {
+ moveJunctionToTab(node,z);
+ return;
+ }
var oldZ = node.z;
allNodes.moveNode(node,z);
var nl = nodeLinks[node.id];
@@ -772,6 +776,38 @@ RED.nodes = (function() {
RED.events.emit("groups:change",group);
}
+ function moveJunctionToTab(junction, z) {
+ var index = junctionsByZ[junction.z].indexOf(junction);
+ junctionsByZ[junction.z].splice(junction,1);
+ junctionsByZ[z] = junctionsByZ[z] || [];
+ junctionsByZ[z].push(junction);
+ junction.z = z;
+
+ var oldZ = junction.z;
+ var nl = nodeLinks[junction.id];
+ if (nl) {
+ nl.in.forEach(function(l) {
+ var idx = linkTabMap[oldZ].indexOf(l);
+ if (idx != -1) {
+ linkTabMap[oldZ].splice(idx, 1);
+ }
+ if ((l.source.z === z) && linkTabMap[z]) {
+ linkTabMap[z].push(l);
+ }
+ });
+ nl.out.forEach(function(l) {
+ var idx = linkTabMap[oldZ].indexOf(l);
+ if (idx != -1) {
+ linkTabMap[oldZ].splice(idx, 1);
+ }
+ if ((l.target.z === z) && linkTabMap[z]) {
+ linkTabMap[z].push(l);
+ }
+ });
+ }
+ RED.events.emit("junctions:change",junction);
+ }
+
function removeLink(l) {
var index = links.indexOf(l);
if (index != -1) {
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js
index 58fca2cb4f..3aeb7151f2 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js
@@ -604,6 +604,14 @@ RED.subflow = (function() {
return x;
}
+ function nodeOrJunction(id) {
+ var node = RED.nodes.node(id);
+ if (node) {
+ return node;
+ }
+ return RED.nodes.junction(id);
+ }
+
function convertToSubflow() {
var selection = RED.view.selection();
if (!selection.nodes) {
@@ -792,14 +800,15 @@ RED.subflow = (function() {
subflow.in.forEach(function(input) {
input.wires.forEach(function(wire) {
- var link = {source: input, sourcePort: 0, target: RED.nodes.node(wire.id) }
+ var link = {source: input, sourcePort: 0, target: nodeOrJunction(wire.id) }
new_links.push(link);
RED.nodes.addLink(link);
});
});
+
subflow.out.forEach(function(output,i) {
output.wires.forEach(function(wire) {
- var link = {source: RED.nodes.node(wire.id), sourcePort: wire.port , target: output }
+ var link = {source: nodeOrJunction(wire.id), sourcePort: wire.port , target: output }
new_links.push(link);
RED.nodes.addLink(link);
});
@@ -815,7 +824,7 @@ RED.subflow = (function() {
n.links = n.links.filter(function(id) {
var isLocalLink = nodes.hasOwnProperty(id);
if (!isLocalLink) {
- var otherNode = RED.nodes.node(id);
+ var otherNode = nodeOrJunction(id);
if (otherNode && otherNode.links) {
var i = otherNode.links.indexOf(n.id);
if (i > -1) {
@@ -831,7 +840,6 @@ RED.subflow = (function() {
RED.nodes.moveNodeToTab(n, subflow.id);
}
-
var historyEvent = {
t:'createSubflow',
nodes:[subflowInstance.id],
From 6f6f67829be75fa41a081dc80093d69af7f587ed Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Mon, 13 Jun 2022 14:12:04 +0900
Subject: [PATCH 21/53] fix undoing junction to subflow
---
.../@node-red/editor-client/src/js/history.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/js/history.js b/packages/node_modules/@node-red/editor-client/src/js/history.js
index f900276a0f..b230712397 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/history.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/history.js
@@ -22,6 +22,14 @@ RED.history = (function() {
var undoHistory = [];
var redoHistory = [];
+ function nodeOrJunction(id) {
+ var node = RED.nodes.node(id);
+ if (node) {
+ return node;
+ }
+ return RED.nodes.junction(id);
+ }
+
function undoEvent(ev) {
var i;
var len;
@@ -514,6 +522,7 @@ RED.history = (function() {
var z = ev.activeWorkspace;
var fullNodeList = RED.nodes.filterNodes({z:ev.subflow.subflow.id});
fullNodeList = fullNodeList.concat(RED.nodes.groups(ev.subflow.subflow.id))
+ fullNodeList = fullNodeList.concat(RED.nodes.junctions(ev.subflow.subflow.id))
fullNodeList.forEach(function(n) {
n.x += ev.subflow.offsetX;
n.y += ev.subflow.offsetY;
@@ -523,7 +532,7 @@ RED.history = (function() {
});
inverseEv.subflows = [];
for (i=0;i
Date: Mon, 13 Jun 2022 21:01:34 +0100
Subject: [PATCH 22/53] Track mouse release outside workspace so current action
completes
---
.../@node-red/editor-client/src/js/ui/view.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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 7d4d950f36..a3bc16e9da 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
@@ -230,6 +230,7 @@ RED.view = (function() {
.on("mousedown", canvasMouseDown)
.on("mouseup", canvasMouseUp)
.on("mouseenter", function() {
+ d3.select(document).on('mouseup.red-ui-workspace-tracker', null)
if (lasso) {
if (d3.event.buttons !== 1) {
lasso.remove();
@@ -245,6 +246,7 @@ RED.view = (function() {
}
}
})
+ .on("mouseleave", canvasMouseLeave)
.on("touchend", function() {
d3.event.preventDefault();
clearTimeout(touchStartTime);
@@ -1719,7 +1721,14 @@ RED.view = (function() {
redraw();
}
}
-
+ function canvasMouseLeave() {
+ if (mouse_mode !== 0 && d3.event.buttons !== 0) {
+ d3.select(document).on('mouseup.red-ui-workspace-tracker', function() {
+ d3.select(document).on('mouseup.red-ui-workspace-tracker', null)
+ canvasMouseUp.call(this)
+ })
+ }
+ }
function canvasMouseUp() {
lastClickPosition = [d3.event.offsetX/scaleFactor,d3.event.offsetY/scaleFactor];
if (RED.view.DEBUG) {
From 2b91edeb7437be104afd7a740a4e0a54aaf127f2 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Tue, 14 Jun 2022 16:49:14 +0900
Subject: [PATCH 23/53] fix uncorrect fix of junction to subflow conversion
---
.../node_modules/@node-red/editor-client/src/js/nodes.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 ab31e50385..052fad5586 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
@@ -778,12 +778,13 @@ RED.nodes = (function() {
function moveJunctionToTab(junction, z) {
var index = junctionsByZ[junction.z].indexOf(junction);
- junctionsByZ[junction.z].splice(junction,1);
+ junctionsByZ[junction.z].splice(index,1);
junctionsByZ[z] = junctionsByZ[z] || [];
junctionsByZ[z].push(junction);
- junction.z = z;
var oldZ = junction.z;
+ junction.z = z;
+
var nl = nodeLinks[junction.id];
if (nl) {
nl.in.forEach(function(l) {
From 3ab93ecdd4845303a69146901aa3f84668da8a1d Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Thu, 16 Jun 2022 00:00:02 +0900
Subject: [PATCH 24/53] fix disable junction
---
.../node_modules/@node-red/editor-client/src/js/ui/view.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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 a15ec32f4d..7b42c7e212 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
@@ -5736,7 +5736,12 @@ RED.view = (function() {
node.dirty = true;
node.dirtyStatus = true;
node.changed = true;
- RED.events.emit("nodes:change",node);
+ if (node.type === "junction") {
+ RED.events.emit("junctions:change",node);
+ }
+ else {
+ RED.events.emit("nodes:change",node);
+ }
}
}
}
From 8d99a42307c08cb7a3a3082e2e2b0bb75fd9d47d Mon Sep 17 00:00:00 2001
From: Kazuhito Yokoi
Date: Thu, 16 Jun 2022 00:32:20 +0900
Subject: [PATCH 25/53] Add Japanese translations (Backport #3576 to v2.x)
---
.../node_modules/@node-red/runtime/locales/ja/runtime.json | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/packages/node_modules/@node-red/runtime/locales/ja/runtime.json b/packages/node_modules/@node-red/runtime/locales/ja/runtime.json
index fdf8b22493..df5f9fa088 100644
--- a/packages/node_modules/@node-red/runtime/locales/ja/runtime.json
+++ b/packages/node_modules/@node-red/runtime/locales/ja/runtime.json
@@ -100,7 +100,9 @@
"error": "クレデンシャルの読み込みエラー: __message__",
"error-saving": "クレデンシャルの保存エラー: __message__",
"not-registered": "クレデンシャル '__type__' は登録されていません",
- "system-key-warning": "\n\n---------------------------------------------------------------------\nフローのクレデンシャルファイルはシステム生成キーで暗号化されています。\n\nシステム生成キーを何らかの理由で失った場合、クレデンシャルファイルを\n復元することはできません。その場合、ファイルを削除してクレデンシャルを\n再入力しなければなりません。\n\n設定ファイル内で 'credentialSecret' オプションを使って独自キーを設定\nします。変更を次にデプロイする際、Node-REDは選択したキーを用いてクレ\nデンシャルを再暗号化します。 \n\n---------------------------------------------------------------------\n"
+ "system-key-warning": "\n\n---------------------------------------------------------------------\nフローのクレデンシャルファイルはシステム生成キーで暗号化されています。\n\nシステム生成キーを何らかの理由で失った場合、クレデンシャルファイルを\n復元することはできません。その場合、ファイルを削除してクレデンシャルを\n再入力しなければなりません。\n\n設定ファイル内で 'credentialSecret' オプションを使って独自キーを設定\nします。変更を次にデプロイする際、Node-REDは選択したキーを用いてクレ\nデンシャルを再暗号化します。 \n\n---------------------------------------------------------------------\n",
+ "unencrypted": "暗号化されていないクレデンシャルを使用",
+ "encryptedNotFound": "暗号化されたクレデンシャルが存在しません"
},
"flows": {
"safe-mode": "セーフモードでフローを停止しました。開始するためにはデプロイしてください",
From d1312703c5d8d46269a8a4893cb8247f680259f7 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Thu, 16 Jun 2022 14:16:40 +0900
Subject: [PATCH 26/53] fix initial cursor position of init/finalize
---
.../@node-red/nodes/core/function/10-function.html | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.html b/packages/node_modules/@node-red/nodes/core/function/10-function.html
index 6309ae9ad5..156abd29de 100644
--- a/packages/node_modules/@node-red/nodes/core/function/10-function.html
+++ b/packages/node_modules/@node-red/nodes/core/function/10-function.html
@@ -460,7 +460,7 @@
}
});
- var buildEditor = function(id, stateId, focus, value, defaultValue, extraLibs) {
+ var buildEditor = function(id, stateId, focus, value, defaultValue, extraLibs, offset) {
var editor = RED.editor.createEditor({
id: id,
mode: 'ace/mode/nrjavascript',
@@ -484,14 +484,14 @@
extraLibs: extraLibs
});
if (defaultValue && value === "") {
- editor.moveCursorTo(defaultValue.split("\n").length - 1, 0);
+ editor.moveCursorTo(defaultValue.split("\n").length +offset, 0);
}
editor.__stateId = stateId;
return editor;
}
- this.initEditor = buildEditor('node-input-init-editor', this.id + "/" + "initEditor", false, $("#node-input-initialize").val(), RED._("node-red:function.text.initialize"))
- this.editor = buildEditor('node-input-func-editor', this.id + "/" + "editor", true, $("#node-input-func").val(), undefined, that.libs || [])
- this.finalizeEditor = buildEditor('node-input-finalize-editor', this.id + "/" + "finalizeEditor", false, $("#node-input-finalize").val(), RED._("node-red:function.text.finalize"))
+ this.initEditor = buildEditor('node-input-init-editor', this.id + "/" + "initEditor", false, $("#node-input-initialize").val(), RED._("node-red:function.text.initialize"), undefined, 0);
+ this.editor = buildEditor('node-input-func-editor', this.id + "/" + "editor", true, $("#node-input-func").val(), undefined, that.libs || [], undefined, -1);
+ this.finalizeEditor = buildEditor('node-input-finalize-editor', this.id + "/" + "finalizeEditor", false, $("#node-input-finalize").val(), RED._("node-red:function.text.finalize"), undefined, 0);
RED.library.create({
url:"functions", // where to get the data from
From ba22b07dcea0bf5bdbd93e25e58632733597925e Mon Sep 17 00:00:00 2001
From: Steve-Mcl
Date: Thu, 16 Jun 2022 10:57:29 +0100
Subject: [PATCH 27/53] align functionality of `nodesDir` with coreNodesDir and
userDir
---
.../@node-red/registry/lib/localfilesystem.js | 195 +++++++++++++-----
1 file changed, 146 insertions(+), 49 deletions(-)
diff --git a/packages/node_modules/@node-red/registry/lib/localfilesystem.js b/packages/node_modules/@node-red/registry/lib/localfilesystem.js
index 62080b4a84..da4006ecc1 100644
--- a/packages/node_modules/@node-red/registry/lib/localfilesystem.js
+++ b/packages/node_modules/@node-red/registry/lib/localfilesystem.js
@@ -88,9 +88,10 @@ function getLocalFile(file) {
/**
* Synchronously walks the directory looking for node files.
* @param dir the directory to search
+ * @param skipValidNodeRedModules a flag to skip lading icons & files if the directory a valid node-red module
* @return an array of fully-qualified paths to .js files
*/
-function getLocalNodeFiles(dir) {
+function getLocalNodeFiles(dir, skipValidNodeRedModules) {
dir = path.resolve(dir);
var result = [];
@@ -102,6 +103,14 @@ function getLocalNodeFiles(dir) {
return {files: [], icons: []};
}
files.sort();
+ // when loading local files, if the path is a valid node-red module
+ // dont include it (will be picked up in scanTreeForNodesModules)
+ if(skipValidNodeRedModules && files.indexOf("package.json") >= 0) {
+ const package = getPackageDetails(dir)
+ if(package.isNodeRedModule) {
+ return {files: [], icons: []};
+ }
+ }
files.forEach(function(fn) {
var stats = fs.statSync(path.join(dir,fn));
if (stats.isFile()) {
@@ -114,7 +123,7 @@ function getLocalNodeFiles(dir) {
} else if (stats.isDirectory()) {
// Ignore /.dirs/, /lib/ /node_modules/
if (!/^(\..*|lib|icons|node_modules|test|locales)$/.test(fn)) {
- var subDirResults = getLocalNodeFiles(path.join(dir,fn));
+ var subDirResults = getLocalNodeFiles(path.join(dir,fn), skipValidNodeRedModules);
result = result.concat(subDirResults.files);
icons = icons.concat(subDirResults.icons);
} else if (fn === "icons") {
@@ -126,21 +135,30 @@ function getLocalNodeFiles(dir) {
return {files: result, icons: icons}
}
-function scanDirForNodesModules(dir,moduleName) {
- var results = [];
- var scopeName;
+function scanDirForNodesModules(dir,moduleName,package) {
+ let results = [];
+ let scopeName;
+ let files
try {
- var files = fs.readdirSync(dir);
- if (moduleName) {
- var m = /^(?:(@[^/]+)[/])?([^@/]+)/.exec(moduleName);
- if (m) {
- scopeName = m[1];
- moduleName = m[2];
+ let isNodeRedModule = false
+ if(package) {
+ dir = path.join(package.moduleDir,'..')
+ files = [path.basename(package.moduleDir)]
+ moduleName = (package.package ? package.package.name : null) || moduleName
+ isNodeRedModule = package.isNodeRedModule
+ } else {
+ files = fs.readdirSync(dir);
+ if (moduleName) {
+ var m = /^(?:(@[^/]+)[/])?([^@/]+)/.exec(moduleName);
+ if (m) {
+ scopeName = m[1];
+ moduleName = m[2];
+ }
}
}
- for (var i=0;i look for node_modules
+ 2. exist(package.json) && package.json.has(node-red) => load this only
+ 3. in original scan of nodesDir, ignore if:(exist(package.json) && package.json.has(node-red))
+ */
+ if (nodesDir) {
+ for (let dirIndex = 0; dirIndex < nodesDir.length; dirIndex++) {
+ const nodeDir = nodesDir[dirIndex];
+ const packageDetails = getPackageDetails(nodeDir)
+ if(packageDetails.isNodeRedModule) {
+ //we have found a node-red module, scan it
+ const nrModules = scanDirForNodesModules(nodeDir, packageDetails.package.name, packageDetails);
+ results = results.concat(nrModules);
+
+ } else if (packageDetails.has_node_modules) {
+ //If this dir has a `node_modues` dir, scan it
+ const nodeModulesDir = path.join(nodeDir, 'node_modules')
+ const nrModules = scanDirForNodesModules(nodeModulesDir, moduleName );
+ results = results.concat(nrModules);
+
+ } else {
+ //If this is not a node-red module AND it does NOT have a node_modules dir,
+ //it may be a directory of project directories or a node_modules dir?
+ //scan this instead
+ const nrModules = scanDirForNodesModules(nodeDir, moduleName);
+ results = results.concat(nrModules);
+ }
}
}
return results;
@@ -274,24 +328,26 @@ function getModuleNodeFiles(module) {
}
function getNodeFiles(disableNodePathScan) {
- var dir;
// Find all of the nodes to load
- var nodeFiles = [];
- var results;
-
- var dir;
- var iconList = [];
+ let results;
+ let nodesDir;
+ if(settings.nodesDir) {
+ nodesDir = Array.isArray(settings.nodesDir) ? settings.nodesDir : [settings.nodesDir]
+ }
+ let dir;
+ let nodeFiles = [];
+ let iconList = [];
if (settings.coreNodesDir) {
results = getLocalNodeFiles(path.resolve(settings.coreNodesDir));
nodeFiles = nodeFiles.concat(results.files);
iconList = iconList.concat(results.icons);
- var defaultLocalesPath = path.join(settings.coreNodesDir,"locales");
+ let defaultLocalesPath = path.join(settings.coreNodesDir,"locales");
i18n.registerMessageCatalog("node-red",defaultLocalesPath,"messages.json");
}
if (settings.userDir) {
dir = path.join(settings.userDir,"lib","icons");
- var icons = scanIconDir(dir);
+ let icons = scanIconDir(dir);
if (icons.length > 0) {
iconList.push({path:dir,icons:icons});
}
@@ -301,13 +357,9 @@ function getNodeFiles(disableNodePathScan) {
nodeFiles = nodeFiles.concat(results.files);
iconList = iconList.concat(results.icons);
}
- if (settings.nodesDir) {
- dir = settings.nodesDir;
- if (typeof settings.nodesDir == "string") {
- dir = [dir];
- }
- for (var i=0;i
Date: Thu, 16 Jun 2022 11:00:31 +0100
Subject: [PATCH 28/53] =?UTF-8?q?improve=20tests=20for=20nodeDir=20Adds=20?=
=?UTF-8?q?new=20resources=20(loose=20files,=20non=20NR=20pkgs,=20NR=20mod?=
=?UTF-8?q?ules,=20NR=20Plugins)=20Adds=20new=20tests=20#getNodeFiles=20-?=
=?UTF-8?q?=20new=20tests=20below=20=20=20=E2=88=9A=20Finds=20nodes=20and?=
=?UTF-8?q?=20icons=20only=20in=20nodesDir=20with=20files,=20icons=20and?=
=?UTF-8?q?=20valid=20node-red=20packages=20=20=20=E2=88=9A=20Should=20not?=
=?UTF-8?q?=20find=20node-red=20node=20in=20nodesDir=20with=20files,=20ico?=
=?UTF-8?q?ns=20and=20valid=20node-red=20packages=20=20=20=E2=88=9A=20Shou?=
=?UTF-8?q?ld=20not=20find=20node-red=20node=20in=20nodesDir=20when=20regu?=
=?UTF-8?q?lar=20package=20and=20valid=20node-red=20packages=20#getModuleF?=
=?UTF-8?q?iles=20-=20new=20tests=20below=20=20=20=E2=88=9A=20gets=20a=20n?=
=?UTF-8?q?odes=20module=20files=20=20=20=E2=88=9A=20Finds=20only=201=20no?=
=?UTF-8?q?de-red=20node=20in=20nodesDir=20amongst=20legacy=20nodes=20and?=
=?UTF-8?q?=20regular=20nodes=20=20=20=E2=88=9A=20Finds=20a=20node-red=20n?=
=?UTF-8?q?ode=20in=20nodesDir=20with=20a=20sub=20dir=20containing=20valid?=
=?UTF-8?q?=20node-red=20package=20=20=20=E2=88=9A=20Finds=202=20node-red?=
=?UTF-8?q?=20node=20and=201=20plugin=20in=20nodesDir=20(in=20root=20of=20?=
=?UTF-8?q?dir)=20=20=20=E2=88=9A=20Finds=202=20node-red=20node=20and=201?=
=?UTF-8?q?=20plugin=20in=20nodesDir=20pointing=20to=20a=20node=5Fmodules?=
=?UTF-8?q?=20dir?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../registry/lib/localfilesystem_spec.js | 226 ++++++++++++++----
.../lib/resources/nodesDir1/icons/loose1.svg | 1 +
.../lib/resources/nodesDir1/loose1.html | 5 +
.../lib/resources/nodesDir1/loose1.js | 4 +
.../nodesDir1/loose2/icons/loose2.svg | 1 +
.../nodesDir1/loose2/icons/loose2b.svg | 1 +
.../resources/nodesDir1/loose2/loose2.html | 5 +
.../lib/resources/nodesDir1/loose2/loose2.js | 4 +
.../node-red-node-testnode/icons/test.svg | 1 +
.../nodesDir1/node-red-node-testnode/main.js | 4 +
.../node-red-node-testnode/package.json | 19 ++
.../nodesDir1/regular_module/icons/test.svg | 1 +
.../nodesDir1/regular_module/main.js | 4 +
.../nodesDir1/regular_module/package.json | 14 ++
.../nodesDir2/@test/testnode/index.html | 5 +
.../nodesDir2/@test/testnode/index.js | 4 +
.../nodesDir2/@test/testnode/package.json | 20 ++
.../resources/nodesDir2/testnode2/index.html | 5 +
.../resources/nodesDir2/testnode2/index.js | 4 +
.../nodesDir2/testnode2/package.json | 20 ++
.../theme-plugin2/files/clientside.js | 3 +
.../nodesDir2/theme-plugin2/files/plugin.js | 14 ++
.../nodesDir2/theme-plugin2/files/theme.css | 1 +
.../nodesDir2/theme-plugin2/package.json | 24 ++
.../node_modules/@test/testnode/index.html | 5 +
.../node_modules/@test/testnode/index.js | 4 +
.../node_modules/@test/testnode/package.json | 20 ++
.../@test/theme-plugin3/files/clientside.js | 3 +
.../@test/theme-plugin3/files/plugin.js | 14 ++
.../@test/theme-plugin3/files/theme.css | 1 +
.../@test/theme-plugin3/package.json | 24 ++
.../node_modules/testnode3/index.html | 5 +
.../nodesDir3/node_modules/testnode3/index.js | 4 +
.../node_modules/testnode3/package.json | 20 ++
34 files changed, 441 insertions(+), 49 deletions(-)
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/icons/loose1.svg
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.html
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2.svg
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2b.svg
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.html
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/icons/test.svg
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/main.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/package.json
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/icons/test.svg
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/main.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/package.json
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.html
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/package.json
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.html
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/package.json
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/clientside.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/plugin.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/theme.css
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/package.json
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.html
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/package.json
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/clientside.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/plugin.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/theme.css
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/package.json
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.html
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.js
create mode 100644 test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/package.json
diff --git a/test/unit/@node-red/registry/lib/localfilesystem_spec.js b/test/unit/@node-red/registry/lib/localfilesystem_spec.js
index e84761657d..3b1bb63f32 100644
--- a/test/unit/@node-red/registry/lib/localfilesystem_spec.js
+++ b/test/unit/@node-red/registry/lib/localfilesystem_spec.js
@@ -14,26 +14,41 @@
* limitations under the License.
**/
-var should = require("should");
-var sinon = require("sinon");
-var path = require("path");
+const should = require("should");
+const sinon = require("sinon");
+const path = require("path");
-var NR_TEST_UTILS = require("nr-test-utils");
+const NR_TEST_UTILS = require("nr-test-utils");
-var localfilesystem = NR_TEST_UTILS.require("@node-red/registry/lib/localfilesystem");
+const localfilesystem = NR_TEST_UTILS.require("@node-red/registry/lib/localfilesystem");
-var resourcesDir = path.resolve(path.join(__dirname,"resources","local"));
-var userDir = path.resolve(path.join(__dirname,"resources","userDir"));
-var moduleDir = path.resolve(path.join(__dirname,"resources","local","TestNodeModule"));
+const resourcesDir = path.resolve(path.join(__dirname,"resources","local"));
+const userDir = path.resolve(path.join(__dirname,"resources","userDir"));
-var i18n = NR_TEST_UTILS.require("@node-red/util").i18n;
+const nodesDir1 = path.resolve(path.join(__dirname,"resources","nodesDir1"))
+const nodesDir2 = path.resolve(path.join(__dirname,"resources","nodesDir2"))
+const nodesDir3 =path.resolve(path.join(__dirname,"resources","nodesDir3"))
+
+const moduleDir = path.resolve(path.join(__dirname,"resources","local","TestNodeModule"));
+
+const i18n = NR_TEST_UTILS.require("@node-red/util").i18n;
describe("red/nodes/registry/localfilesystem",function() {
+ var stubs = [];
+ function stubPathJoin() {
+ var _join = path.join;
+ stubs.push(sinon.stub(path,"join").callsFake(function() {
+ if (arguments[0] == resourcesDir) {
+ // This stops the module tree scan from going any higher
+ // up the tree than resourcesDir.
+ return arguments[0];
+ }
+ return _join.apply(null,arguments);
+ }));
+ }
beforeEach(function() {
stubs.push(sinon.stub(i18n,"registerMessageCatalog").callsFake(function() { return Promise.resolve(); }));
})
-
- var stubs = [];
afterEach(function() {
while(stubs.length) {
stubs.pop().restore();
@@ -129,16 +144,76 @@ describe("red/nodes/registry/localfilesystem",function() {
checkNodes(nm.nodes,['TestNode5'],['TestNode1']);
done();
});
+ it("Finds nodes and icons only in nodesDir with files, icons and valid node-red packages",function(done) {
+ localfilesystem.init({nodesDir:nodesDir1});
+ const nodeList = localfilesystem.getNodeFiles(true);
+ nodeList.should.have.a.property("node-red");
+ const nm = nodeList['node-red'];
+ nm.should.have.a.property('name','node-red');
+ nm.should.have.a.property("nodes");
+ nm.should.have.a.property("icons");
+ checkNodes(nm.nodes,['loose1', 'loose2'], []);
+ //1 icon in nodesDir1/icons/ - should be found
+ //2 icons in nodesDir1/loose2/icons/ - should be found
+ //1 icons in nodesDir1/node-red-node-testnode/icons/ - should be found
+ //1 icons in nodesDir1/regular_module/icons/ - should NOT be found
+ //total icon sets 3, total icons 4
+ nm.icons.should.have.a.property("length", 3);
+ nm.icons[0].should.have.a.property("path")
+ nm.icons[0].should.have.a.property("icons", ['loose1.svg'])
+ nm.icons[1].should.have.a.property("path")
+ nm.icons[1].should.have.a.property("icons", ['loose2.svg', 'loose2b.svg'])
+ nm.icons[2].should.have.a.property("path")
+ nm.icons[2].should.have.a.property("icons", ['test.svg'])
+ done();
+ });
+ it("Should not find node-red node in nodesDir with files, icons and valid node-red packages",function(done) {
+ // path contains a regular node module and a node-red node module
+ localfilesystem.init({nodesDir:path.join(nodesDir1)});
+ const nodeList = localfilesystem.getNodeFiles(true);
+ nodeList.should.have.a.property("node-red");
+ const nm = nodeList['node-red'];
+ nm.should.have.a.property('name','node-red');
+ nm.should.have.a.property("nodes");
+ nm.nodes.should.have.a.property("loose1");
+ nm.nodes.should.have.a.property("loose2");
+ nm.nodes.should.not.have.a.property("regular_module");
+ nm.nodes.should.not.have.a.property("node-red-node-testnode");
+ for (let key of Object.keys(nm.nodes)) {
+ const n = nm.nodes[key];
+ n.file.indexOf("regular_module").should.eql(-1, `found icons in a node-red module`)
+ n.file.indexOf("node-red-node-testnode").should.eql(-1, `found icons in a node-red module`)
+ }
+ //1 icon in nodesDir1/icons/ - should be found
+ //2 icons in nodesDir1/loose2/icons/ - should be found
+ //1 icons in nodesDir1/node-red-node-testnode/icons/ - should be found
+ //1 icons in nodesDir1/regular_module/icons/ - should NOT be found
+ //total icon sets 3, total icons 4
+ nm.should.have.a.property("icons");
+ nm.icons.should.have.a.property("length", 3);
+ let iconCount = 0;
+ for (let index = 0; index < nm.icons.length; index++) {
+ const iconDir = nm.icons[index];
+ iconCount += iconDir.icons.length
+ iconDir.path.indexOf("node-red-node-testnode").should.eql(-1, `should not find icons in a node-red module`)
+ }
+ should(iconCount).eql(4, "Should find only 4 icons")
+ done();
+ });
+ it("Should not find node-red node in nodesDir when regular package and valid node-red packages",function(done) {
+ localfilesystem.init({nodesDir:path.join(nodesDir1,"regular_module")});
+ const nodeList = localfilesystem.getNodeFiles(true);
+ nodeList.should.have.a.property("node-red");
+ const nm = nodeList['node-red'];
+ nm.should.have.a.property('name','node-red');
+ nm.should.have.a.property("nodes", {});
+ nm.should.have.a.property("icons");
+ nm.icons.should.have.a.property("length", 1); //should find 1 icons folder
+ nm.icons[0].should.have.a.property("icons", [ 'test.svg' ]); //should find 1 icon in regular package
+ done();
+ });
it("Finds nodes module path",function(done) {
- var _join = path.join;
- stubs.push(sinon.stub(path,"join").callsFake(function() {
- if (arguments[0] == resourcesDir) {
- // This stops the module tree scan from going any higher
- // up the tree than resourcesDir.
- return arguments[0];
- }
- return _join.apply(null,arguments);
- }));
+ stubPathJoin()
localfilesystem.init({coreNodesDir:moduleDir});
var nodeList = localfilesystem.getNodeFiles();
nodeList.should.have.a.property("node-red");
@@ -166,8 +241,6 @@ describe("red/nodes/registry/localfilesystem",function() {
i18n.registerMessageCatalog.lastCall.args[1].should.eql(path.resolve(path.join(moduleDir,"locales")));
i18n.registerMessageCatalog.lastCall.args[2].should.eql('messages.json');
-
-
done();
});
it.skip("finds locales directory");
@@ -205,15 +278,7 @@ describe("red/nodes/registry/localfilesystem",function() {
});
describe("#getModuleFiles",function() {
it("gets a nodes module files",function(done) {
- var _join = path.join;
- stubs.push(sinon.stub(path,"join").callsFake(function() {
- if (arguments[0] == resourcesDir) {
- // This stops the module tree scan from going any higher
- // up the tree than resourcesDir.
- return arguments[0];
- }
- return _join.apply(null,arguments);
- }));
+ stubPathJoin()
localfilesystem.init({coreNodesDir:moduleDir});
var nodeModule = localfilesystem.getModuleFiles('TestNodeModule');
nodeModule.should.have.a.property('TestNodeModule');
@@ -230,16 +295,87 @@ describe("red/nodes/registry/localfilesystem",function() {
done();
});
+ it("Finds only 1 node-red node in nodesDir amongst legacy nodes and regular nodes",function(done) {
+ stubPathJoin()
+ localfilesystem.init({nodesDir:[path.join(nodesDir1,"node-red-node-testnode")]});
+ const nodeModule = localfilesystem.getModuleFiles();
+ const loaded = Object.keys(nodeModule)
+ loaded.should.have.a.property("length", 1)
+ loaded.indexOf('node-red-node-testnode').should.greaterThan(-1, "Should load node-red-node-testnode")
+
+ nodeModule['node-red-node-testnode'].should.have.a.property('name','node-red-node-testnode');
+ nodeModule['node-red-node-testnode'].should.have.a.property('version','1.0.0');
+ nodeModule['node-red-node-testnode'].should.have.a.property('nodes');
+ nodeModule['node-red-node-testnode'].should.have.a.property('path');
+ nodeModule['node-red-node-testnode'].should.have.a.property('user', false);
+ checkNodes(nodeModule['node-red-node-testnode'].nodes,['testnode'],[],'node-red-node-testnode');
+ done();
+ });
+ it("Finds a node-red node in nodesDir with a sub dir containing valid node-red package",function(done) {
+ stubPathJoin()
+ localfilesystem.init({nodesDir:[path.join(nodesDir1,"node-red-node-testnode")]});
+ const nodeModule = localfilesystem.getModuleFiles();
+ const loaded = Object.keys(nodeModule)
+ nodeModule['node-red-node-testnode'].should.have.a.property('name','node-red-node-testnode');
+ nodeModule['node-red-node-testnode'].should.have.a.property('version','1.0.0');
+ nodeModule['node-red-node-testnode'].should.have.a.property('nodes');
+ nodeModule['node-red-node-testnode'].should.have.a.property('path');
+ nodeModule['node-red-node-testnode'].should.have.a.property('user', false);
+ checkNodes(nodeModule['node-red-node-testnode'].nodes,['testnode'],[],'node-red-node-testnode');
+ done();
+ });
+ it("Finds 2 node-red modules and 1 plugin in nodesDir (in root of dir)",function(done) {
+ stubPathJoin()
+ localfilesystem.init({nodesDir:[nodesDir2]});
+ const nodeModule = localfilesystem.getModuleFiles();
+ const loaded = Object.keys(nodeModule)
+ loaded.should.have.a.property("length", 3)
+ loaded.indexOf('@test/testnode').should.greaterThan(-1, "Should load @test/testnode")
+ loaded.indexOf('testnode2').should.greaterThan(-1, "Should load testnode2")
+ loaded.indexOf('test-theme2').should.greaterThan(-1, "Should load test-theme2")
+
+ nodeModule['@test/testnode'].should.have.a.property('name','@test/testnode');
+ nodeModule['@test/testnode'].should.have.a.property('version','1.0.0');
+ nodeModule['@test/testnode'].should.have.a.property('nodes');
+ nodeModule['@test/testnode'].should.have.a.property('path');
+ nodeModule['@test/testnode'].should.have.a.property('user', false);
+
+ nodeModule['testnode2'].should.have.a.property('name','testnode2');
+ nodeModule['testnode2'].should.have.a.property('version','1.0.0');
+ nodeModule['testnode2'].should.have.a.property('nodes');
+ nodeModule['testnode2'].should.have.a.property('path');
+ nodeModule['testnode2'].should.have.a.property('user', false);
+
+ nodeModule['test-theme2'].should.have.a.property('name','test-theme2');
+
+ nodeModule['test-theme2'].should.have.a.property('version','0.0.1');
+ nodeModule['test-theme2'].should.have.a.property('nodes', {});
+ nodeModule['test-theme2'].should.have.a.property('path');
+ nodeModule['test-theme2'].should.have.a.property('user', false);
+ nodeModule['test-theme2'].should.have.a.property('plugins');
+ nodeModule['test-theme2'].plugins.should.have.a.property('test-theme2');
+ nodeModule['test-theme2'].plugins['test-theme2'].should.have.a.property('name','test-theme2');
+ nodeModule['test-theme2'].plugins['test-theme2'].should.have.a.property('module','test-theme2');
+ nodeModule['test-theme2'].plugins['test-theme2'].should.have.a.property('version', '0.0.1');
+ nodeModule['test-theme2'].plugins['test-theme2'].should.have.a.property('file');
+ nodeModule['test-theme2'].plugins['test-theme2'].should.have.a.property('local', false);
+
+ done();
+ });
+ it("Finds 2 node-red modules and 1 plugin in nodesDir pointing to a node_modules dir",function(done) {
+ stubPathJoin()
+ localfilesystem.init({nodesDir:[path.join(nodesDir3, "node_modules")]});
+ const nodeModule = localfilesystem.getModuleFiles();
+ const loaded = Object.keys(nodeModule)
+ loaded.should.have.a.property("length", 3)
+
+ loaded.indexOf('@test/testnode').should.greaterThan(-1, "Should load @test/testnode")
+ loaded.indexOf('@test/test-theme3').should.greaterThan(-1, "Should load test-theme3")
+ loaded.indexOf('testnode3').should.greaterThan(-1, "Should load testnode3")
+ done();
+ });
it("throws an error if a node isn't found",function(done) {
- var _join = path.join;
- stubs.push(sinon.stub(path,"join").callsFake(function() {
- if (arguments[0] == resourcesDir) {
- // This stops the module tree scan from going any higher
- // up the tree than resourcesDir.
- return arguments[0];
- }
- return _join.apply(null,arguments);
- }));
+ stubPathJoin()
localfilesystem.init({coreNodesDir:moduleDir});
/*jshint immed: false */
(function(){
@@ -250,15 +386,7 @@ describe("red/nodes/registry/localfilesystem",function() {
it.skip("finds locales directory");
it.skip("finds icon path directory");
it("scans icon files with a module file",function(done) {
- var _join = path.join;
- stubs.push(sinon.stub(path,"join").callsFake(function() {
- if (arguments[0] == resourcesDir) {
- // This stops the module tree scan from going any higher
- // up the tree than resourcesDir.
- return arguments[0];
- }
- return _join.apply(null,arguments);
- }));
+ stubPathJoin()
localfilesystem.init({
coreNodesDir: moduleDir
});
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/icons/loose1.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/icons/loose1.svg
new file mode 100644
index 0000000000..927680ee3b
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/icons/loose1.svg
@@ -0,0 +1 @@
+
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.html b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.html
new file mode 100644
index 0000000000..8f392056c6
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.js
new file mode 100644
index 0000000000..624cfe6d8e
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from loose1.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2.svg
new file mode 100644
index 0000000000..04bebc3701
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2.svg
@@ -0,0 +1 @@
+
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2b.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2b.svg
new file mode 100644
index 0000000000..2503488614
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2b.svg
@@ -0,0 +1 @@
+
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.html b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.html
new file mode 100644
index 0000000000..e23e2880a9
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.js
new file mode 100644
index 0000000000..e1cde2a825
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from loose2.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/icons/test.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/icons/test.svg
new file mode 100644
index 0000000000..04bebc3701
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/icons/test.svg
@@ -0,0 +1 @@
+
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/main.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/main.js
new file mode 100644
index 0000000000..e2e0781d15
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/main.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from regular module main.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/package.json
new file mode 100644
index 0000000000..26d4151fb5
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "node-red-node-testnode",
+ "version": "1.0.0",
+ "description": "A node-red node that does nothing other than exist",
+ "main": "main.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "node-red"
+ ],
+ "node-red": {
+ "nodes": {
+ "testnode": "index.js"
+ }
+ },
+ "author": "@testyMcTersterson",
+ "license": "MIT"
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/icons/test.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/icons/test.svg
new file mode 100644
index 0000000000..04bebc3701
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/icons/test.svg
@@ -0,0 +1 @@
+
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/main.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/main.js
new file mode 100644
index 0000000000..e2e0781d15
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/main.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from regular module main.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/package.json
new file mode 100644
index 0000000000..23cfd7e862
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "regular_node",
+ "version": "1.0.0",
+ "description": "A regular node that does nothing other than exist",
+ "main": "main.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "test"
+ ],
+ "author": "@testyMcTersterson",
+ "license": "MIT"
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.html
new file mode 100644
index 0000000000..0e45b30070
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.js
new file mode 100644
index 0000000000..1fe9d89a38
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from @test/testnode index.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/package.json
new file mode 100644
index 0000000000..a32462631c
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "@test/testnode",
+ "version": "1.0.0",
+ "description": "A test node that does nothing other than exist",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "node-red",
+ "test"
+ ],
+ "node-red": {
+ "nodes": {
+ "testnode": "index.js"
+ }
+ },
+ "author": "@testyMcTersterson",
+ "license": "MIT"
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.html
new file mode 100644
index 0000000000..5d9f2b0ec5
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.js
new file mode 100644
index 0000000000..0f0eba392b
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from testnode2 index.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/package.json
new file mode 100644
index 0000000000..f9e8aecbe5
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "testnode2",
+ "version": "1.0.0",
+ "description": "A test node that does nothing other than exist",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "node-red",
+ "test"
+ ],
+ "node-red": {
+ "nodes": {
+ "testnode2": "index.js"
+ }
+ },
+ "author": "@testyMcTersterson",
+ "license": "MIT"
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/clientside.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/clientside.js
new file mode 100644
index 0000000000..fb2e222895
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/clientside.js
@@ -0,0 +1,3 @@
+(function() {
+ console.log("Hi from test plugin client side")
+})()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/plugin.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/plugin.js
new file mode 100644
index 0000000000..3202aeb8bb
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/plugin.js
@@ -0,0 +1,14 @@
+module.exports = function (RED) {
+ RED.plugins.registerPlugin('test-theme', {
+ type: 'node-red-theme',
+ scripts: [
+ 'files/clientside.js'
+ ],
+ css: [
+ 'files/theme.css',
+ ],
+ monacoOptions: {
+ theme: "vs"
+ }
+ })
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/theme.css b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/theme.css
new file mode 100644
index 0000000000..872c93e109
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/theme.css
@@ -0,0 +1 @@
+:root{--red-ui-primary-background: #f2f3fb;}
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/package.json
new file mode 100644
index 0000000000..b8608c1751
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "test-theme2",
+ "version": "0.0.1",
+ "description": "test theme for Node-RED",
+
+ "keywords": [
+ "node-red",
+ "plugin",
+ "theme"
+ ],
+ "author": {
+ "name": "testy-McTesterson"
+ },
+ "license": "MIT",
+ "node-red": {
+ "version": ">=2.2.0",
+ "plugins": {
+ "test-theme2": "files/plugin.js"
+ }
+ },
+ "engines": {
+ "node": ">=12.x"
+ }
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.html
new file mode 100644
index 0000000000..0e45b30070
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.js
new file mode 100644
index 0000000000..1fe9d89a38
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from @test/testnode index.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/package.json
new file mode 100644
index 0000000000..a32462631c
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "@test/testnode",
+ "version": "1.0.0",
+ "description": "A test node that does nothing other than exist",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "node-red",
+ "test"
+ ],
+ "node-red": {
+ "nodes": {
+ "testnode": "index.js"
+ }
+ },
+ "author": "@testyMcTersterson",
+ "license": "MIT"
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/clientside.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/clientside.js
new file mode 100644
index 0000000000..fb2e222895
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/clientside.js
@@ -0,0 +1,3 @@
+(function() {
+ console.log("Hi from test plugin client side")
+})()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/plugin.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/plugin.js
new file mode 100644
index 0000000000..3202aeb8bb
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/plugin.js
@@ -0,0 +1,14 @@
+module.exports = function (RED) {
+ RED.plugins.registerPlugin('test-theme', {
+ type: 'node-red-theme',
+ scripts: [
+ 'files/clientside.js'
+ ],
+ css: [
+ 'files/theme.css',
+ ],
+ monacoOptions: {
+ theme: "vs"
+ }
+ })
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/theme.css b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/theme.css
new file mode 100644
index 0000000000..872c93e109
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/theme.css
@@ -0,0 +1 @@
+:root{--red-ui-primary-background: #f2f3fb;}
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/package.json
new file mode 100644
index 0000000000..56b1bfb6db
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@test/test-theme3",
+ "version": "0.0.1",
+ "description": "test theme for Node-RED",
+
+ "keywords": [
+ "node-red",
+ "plugin",
+ "theme"
+ ],
+ "author": {
+ "name": "testy-McTesterson"
+ },
+ "license": "MIT",
+ "node-red": {
+ "version": ">=2.2.0",
+ "plugins": {
+ "test-theme3": "files/plugin.js"
+ }
+ },
+ "engines": {
+ "node": ">=12.x"
+ }
+}
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.html
new file mode 100644
index 0000000000..a4034f3402
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.js
new file mode 100644
index 0000000000..855768ad8c
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.js
@@ -0,0 +1,4 @@
+
+ (function() {
+ console.log("hello from testnode3 index.js")
+ })()
diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/package.json
new file mode 100644
index 0000000000..41e9bb8f8d
--- /dev/null
+++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "testnode3",
+ "version": "1.0.0",
+ "description": "A test node that does nothing other than exist",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "node-red",
+ "test"
+ ],
+ "node-red": {
+ "nodes": {
+ "testnode3": "index.js"
+ }
+ },
+ "author": "@testyMcTersterson",
+ "license": "MIT"
+}
From 62a2a4a9f5b90b660d790eaf626ac20d16e91db4 Mon Sep 17 00:00:00 2001
From: Steve-Mcl
Date: Thu, 16 Jun 2022 11:38:19 +0100
Subject: [PATCH 29/53] Further simplify file node filename entry UX (v3) fixes
#3668
---
.../@node-red/nodes/core/storage/10-file.html | 16 ++++++++--------
.../@node-red/nodes/locales/en-US/messages.json | 1 +
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/packages/node_modules/@node-red/nodes/core/storage/10-file.html b/packages/node_modules/@node-red/nodes/core/storage/10-file.html
index b726b537de..6b19ebaa82 100755
--- a/packages/node_modules/@node-red/nodes/core/storage/10-file.html
+++ b/packages/node_modules/@node-red/nodes/core/storage/10-file.html
@@ -198,8 +198,8 @@
category: 'storage',
defaults: {
name: {value:""},
- filename: {value:"filename"},
- filenameType: {value:"msg"},
+ filename: {value:""},
+ filenameType: {value:"str"},
appendNewline: {value:true},
createDir: {value:false},
overwriteFile: {value:"false"},
@@ -236,8 +236,8 @@
label: node._("file.encoding.setbymsg")
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
- default: "msg",
- types: ["str", "msg", "jsonata", "env"],
+ default: "str",
+ types: [{label:RED._("node-red:file.label.path"), value:"str", icon:""}, "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {
@@ -297,8 +297,8 @@
category: 'storage',
defaults: {
name: {value:""},
- filename: {value:"filename"},
- filenameType: {value:"msg"},
+ filename: {value:""},
+ filenameType: {value:"str"},
format: {value:"utf8"},
chunk: {value:false},
sendError: {value: false},
@@ -341,8 +341,8 @@
label: label
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
- default: "msg",
- types: ["str", "msg", "jsonata", "env"],
+ default: "str",
+ types: [{label:RED._("node-red:file.label.path"), value:"str", icon:""}, "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {
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 77d832abde..62d5f351f4 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
@@ -928,6 +928,7 @@
"write": "write file",
"read": "read file",
"filename": "Filename",
+ "path": "path",
"action": "Action",
"addnewline": "Add newline (\\n) to each payload?",
"createdir": "Create directory if it doesn't exist?",
From ea469470541de61bcb13dc8dc4a120a9c6905673 Mon Sep 17 00:00:00 2001
From: Nick O'Leary
Date: Thu, 16 Jun 2022 13:48:36 +0100
Subject: [PATCH 30/53] Add RED.actions.getLabel to retrieve action i18n label
---
.../editor-client/src/js/ui/actions.js | 53 +++++++++++--------
1 file changed, 31 insertions(+), 22 deletions(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/actions.js b/packages/node_modules/@node-red/editor-client/src/js/ui/actions.js
index 2273ae9ab4..5bd9ea0344 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/actions.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/actions.js
@@ -21,6 +21,34 @@ RED.actions = (function() {
function getAction(name) {
return actions[name].handler;
}
+ function getActionLabel(name) {
+ let def = actions[name]
+ if (!def) {
+ return ''
+ }
+ if (!def.label) {
+ var options = def.options;
+ var key = options ? options.label : undefined;
+ if (!key) {
+ key = "action-list." +name.replace(/^.*:/,"");
+ }
+ var label = RED._(key);
+ if (label === key) {
+ // no translation. convert `name` to description
+ label = name.replace(/(^.+:([a-z]))|(-([a-z]))/g, function() {
+ if (arguments[5] === 0) {
+ return arguments[2].toUpperCase();
+ } else {
+ return " "+arguments[4].toUpperCase();
+ }
+ });
+ }
+ def.label = label;
+ }
+ return def.label
+ }
+
+
function invokeAction() {
var args = Array.prototype.slice.call(arguments);
var name = args.shift();
@@ -31,7 +59,7 @@ RED.actions = (function() {
}
function listActions() {
var result = [];
- var missing = [];
+
Object.keys(actions).forEach(function(action) {
var def = actions[action];
var shortcut = RED.keyboard.getShortcut(action);
@@ -42,28 +70,8 @@ RED.actions = (function() {
isUser = !!RED.keyboard.getUserShortcut(action);
}
if (!def.label) {
- var name = action;
- var options = def.options;
- var key = options ? options.label : undefined;
- if (!key) {
- key = "action-list." +name.replace(/^.*:/,"");
- }
- var label = RED._(key);
- if (label === key) {
- // no translation. convert `name` to description
- label = name.replace(/(^.+:([a-z]))|(-([a-z]))/g, function() {
- if (arguments[5] === 0) {
- return arguments[2].toUpperCase();
- } else {
- return " "+arguments[4].toUpperCase();
- }
- });
- missing.push(key);
- }
- def.label = label;
+ def.label = getActionLabel(action)
}
- //console.log("; missing:", missing);
-
result.push({
id:action,
scope:shortcut?shortcut.scope:undefined,
@@ -79,6 +87,7 @@ RED.actions = (function() {
add: addAction,
remove: removeAction,
get: getAction,
+ getLabel: getActionLabel,
invoke: invokeAction,
list: listActions
}
From 6bea3dabbb4a999a4c3fb77926ec0b0b154664b6 Mon Sep 17 00:00:00 2001
From: Nick O'Leary
Date: Thu, 16 Jun 2022 13:49:25 +0100
Subject: [PATCH 31/53] Allow popover position to be set via absolute pos
rather than relative
---
.../@node-red/editor-client/src/js/ui/common/popover.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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 f1728ed839..9ddd3d8666 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
@@ -610,10 +610,13 @@ RED.popover = (function() {
var target = options.target;
var align = options.align || "right";
var offset = options.offset || [0,0];
+ var xPos = options.x;
+ var yPos = options.y;
+ var isAbsolutePosition = (xPos !== undefined && yPos !== undefined)
- var pos = target.offset();
- var targetWidth = target.width();
- var targetHeight = target.outerHeight();
+ var pos = isAbsolutePosition?{left:xPos, top: yPos}:target.offset();
+ var targetWidth = isAbsolutePosition?0:target.width();
+ var targetHeight = isAbsolutePosition?0:target.outerHeight();
var panelHeight = panel.height();
var panelWidth = panel.width();
From cce4f6f7f764675d6c9eecd611fde310f657f054 Mon Sep 17 00:00:00 2001
From: Nick O'Leary
Date: Thu, 16 Jun 2022 13:50:05 +0100
Subject: [PATCH 32/53] Add onpre/postselect, direction opts to menu and make
id optional
---
.../editor-client/src/js/ui/common/menu.js | 51 +++++++++++++++----
1 file changed, 42 insertions(+), 9 deletions(-)
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js
index 417189b33c..6327f52686 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js
@@ -16,6 +16,7 @@
RED.menu = (function() {
var menuItems = {};
+ let menuItemCount = 0
function createMenuItem(opt) {
var item;
@@ -59,15 +60,16 @@ RED.menu = (function() {
item = $('');
} else {
item = $('');
-
+ if (!opt.id) {
+ opt.id = 'red-ui-menu-item-'+(menuItemCount++)
+ }
if (opt.group) {
item.addClass("red-ui-menu-group-"+opt.group);
-
}
var linkContent = '';
if (opt.toggle) {
- linkContent += '';
- linkContent += '';
+ linkContent += '';
+ linkContent += '';
}
if (opt.icon !== undefined) {
@@ -77,12 +79,15 @@ RED.menu = (function() {
linkContent += ' ';
}
}
-
+ let label = opt.label
+ if (!opt.label && typeof opt.onselect === 'string') {
+ label = RED.actions.getLabel(opt.onselect)
+ }
if (opt.sublabel) {
- linkContent += ''+opt.label+''+
+ linkContent += ''+label+''+
''+opt.sublabel+''
} else {
- linkContent += ''+opt.label+''
+ linkContent += ''+label+''
}
linkContent += '';
@@ -126,10 +131,21 @@ RED.menu = (function() {
});
}
if (opt.options) {
- item.addClass("red-ui-menu-dropdown-submenu pull-left");
+ item.addClass("red-ui-menu-dropdown-submenu"+(opt.direction!=='right'?" pull-left":""));
var submenu = $('