Merge branch 'master' into update-git-ignore

This commit is contained in:
Nick O'Leary
2025-12-03 13:56:33 +00:00
committed by GitHub
282 changed files with 21392 additions and 44167 deletions

View File

@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
node-version: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}

View File

@@ -1,3 +1,154 @@
#### 4.1.1: Maintenance Release
Editor
- Filter suggestions to ensure only enabled set are shown (#5307) @GogoVega
- Show all catalog items if small enough and no search time provided (#5309) @knolleary
- Force a redraw after clearing suggested flow on mouse down (#5306) @knolleary
- i18n(NodeRed) update ES translation files to latest code base (#5299) @joebordes
- Filter suggestions to ensure only known types are shown (#5301) @knolleary
- Use the action label if provided (#5302) @GogoVega
- Handle subflow virtual port nodes when generating quick-add context (#5296) @knolleary
- Prevents label from taking up all the space for env autocomplete (#5293) @GogoVega
- Fix env autocomplete result if searchKey starts with `${` (#5292) @GogoVega
- Fix UI lock-up when typed arrays are expanded in debug window (#5290) @Steve-Mcl
- Notify installed plugins from the Palette Manager (#5277) @GogoVega
- Fix uncaught Monaco error (#5266) @Steve-Mcl
- Add 'url' module to default server-side types in Monaco editor (#5265) @Steve-Mcl
- Catch errors from RED.comms.subscribe callback (#5263) @hardillb
- Fix node documentation icon for long catalog loading (#5237) @GogoVega
- Add tooltip for event log view (#5239) @kazuhitoyokoi
- Fix undo node output changes inside a Subflow (#5278) @GogoVega
Runtime
- Ensure flow property is set on sf instance nodes so NR_SUBFLOW_PATH c… (#5297) @knolleary
- Ignore disabled nodes when checking for dependency modules (#5295) @knolleary
- Update node-red-admin version (#5294) @knolleary
- Fix config node resolution in packaged subflow within subflow (#5281) @olivierpelet
- Remove empty if block (#5273) @bonanitech
- docs: add security escalation policy (#5269) @UlisesGascon
- Simplify error logging when issue in settings file (#5310) @knolleary
Nodes
- Inject: Fix jsonata error reporting in Inject node (#5298) @knolleary
- Range: Fix rounding errors for range node when using float inputs and intege… (#5257) @dceejay
- HTTP Request: Show requesting status correctly in http request node when multiple processes are working (#5241) @kazuhitoyokoi
- Split: Speed up split node (#5252) @hardillb
- HTTP: Do not assume rawBody middleware is last in stack when moving it (#5300) @knolleary
#### 4.1.0: Milestone Release
- Fix: multipart form data upload issue (#5228) @debadutta98
- Update help document of filter node (#5210) @kazuhitoyokoi
- Fix inject node validation to support binary and hexadecimal numbers (#5212) @ZJvandeWeg
- Do not select a nearest node if move is active (#5199) @GogoVega
#### 4.1.0-beta.2: Beta Release
Editor
- feat: tray's primary button function will no longer run when clicking anywhere in #red-ui-editor-shade (#5122) @AllanOricil
- Truncate topic of debug message and add tooltip (#5168) @GogoVega
- Add event-log widget to status bar (#5181) @knolleary
- Add `splice` property to nodes:add event context (#5195) @knolleary
- Add support for plugin sources of autoComplete fields (#5194) @knolleary
- setSuggestedFlow api improvements (#5180) @knolleary
- Do not update suggestion whilst typeSearch hiding (#5193) @knolleary
- Update jquery (#5192) @knolleary
- Hide event log status widget by default (#5191) @knolleary
- Swap manage/install-all buttons in dependency notification (#5189) @knolleary
- Follow-up tweaks to HTTP In skip body parser (#5188) @knolleary
- Fixes infotip handling of cursor keys and updates english tip (#5187) @knolleary
- Add Japanese translations for 4.1.0-beta.1 (#5173) @kazuhitoyokoi
- Do not use css display when counting filtered palette nodes (#5178) @knolleary
- Fix `pending_version` not set after module update (#5169) @GogoVega
Runtime
- Prevent library leaking full local paths (#5186) @hardillb
Nodes
- HTTP In: feat: Add an option to the HTTP In to include the raw body. (#5037) @debadutta98
- HTTP Request: Allow limited Strings for msg.rejectUnauthorized (#5172) @hardillb
#### 4.1.0-beta.1: Beta Release
Editor
- Add update notification (#5117) @knolleary
- Add a node annotation if the info property is set (#4955) @knolleary
- Add node suggestion api to editor and apply to typeSearch (#5135) @knolleary
- Node filter support for typedInput's builtin node (#5154) @GogoVega
- Import `got` module only once when sending metrics (#5152) @GogoVega
- Trigger button action of the selected nodes with new Hotkey (#4924) @GogoVega
- Handle deleting of subflow context entries (#5071) @knolleary
- Add the `changed` badge to the config node (#5062) @GogoVega
- Default Palette Search: Sort by Downloads (#5108) @joepavitt
- Show deprecated message if module flagged (#5134) @knolleary
- Add link icon to node docs and warn for major update (#5143) @GogoVega
- Support for a module with nodes and plugins in the palette (#4945) @GogoVega
- Include module list in global-config node when importing/exporting flows (#4599) @knolleary
- Add `Install all` button to the module list feature (#5123) @GogoVega
- Fix node tab filtering (#5119) @knolleary
- Cleanup global Palette Manager variables (#4958) @GogoVega
- Add a new `update available` widget to statusBar (#4948) @knolleary
- Add a queue while installing or removing a module from the Palette Manager (#4937) @GogoVega
- Ignore state of disabled nodes/flows during deployment (#5054) @GogoVega
- Exclude internal properties from node definition (#5144) @GogoVega
- Refresh config node sidebar when changing lock state of a flow (#5072) @knolleary
- Add a border to better distinguish typedInput type/option dropdowns (#5078) @knolleary
- Fix undo of subflow color change not applying to instances (#5012) @GogoVega
- Properly handle scale factor in getLinksAtPoint for firefox (#5087) @knolleary
- Update markdown drop-target appearance (#5059) @knolleary
- Support for disabled flows in Sidebar Config (#5061) @GogoVega
- Support text drag & drop into markdown editor (#5056) @gorenje
- Truncate long messages from the Debug Sidebar (#4944) @GogoVega
- Handle link nodes with show/hide label action (#5106) @knolleary
- Update the Node-RED logo to use the hex variant (#5103) @joepavitt
- Add the vertical marker to the palette hand (#4954) @GogoVega
- Monaco Latest (0.52.0) (#4930) @Steve-Mcl
- Updates monaco to 0.52.0 for action widget sizing fix (#5110) @Steve-Mcl
- Bump Multer to 2.0.1 (#5151) @hardillb
- Upgrade multer to 2.0.0 (#5148) @hardillb
- Update dompurify (#5120) @knolleary
- Colourise the Node-RED logs (#5109) @hardillb
- Only apply colours for non-default log lines (#5129) @knolleary
- feat: import default export if plugin is a transpiled es module (#5137) @dschmidt
- Add an additional git_auth_failed condition (#5145) @sonnyp
- Fix Sass deprecation warnings (#4922) @bonanitech
- chore(editor)!: remove Internet Explorer polyfill (#5070) @Rotzbua
- Remove Internet Explorer CSS hacks (#5142) @bonanitech
Runtime
- fix: set label in themeSettings.deployButton despite type attribute (#5053) @matiseni51
- fix(html): correct buggy html (#4768) @Rotzbua
- Update dev (#4836) @knolleary
- Update dependencies (#5107) @knolleary
- Bump i18next to 24.x and auto-migrate message catalog format (#5088) @knolleary
- chore(editor): update `DOMPurify` flag (#5073) @Rotzbua
- Add .editorconfig to .gitignore (#5060) @gorenje
Nodes
- Complete/Status: Fix complete node to not feedback immediately connected nodes (#5114) @dceejay
- Function: Add URL/URLSearchParams to Function sandbox (#5159) @knolleary
- Function: Add support for node: prefixed modules in function node (#5067) @knolleary
- Function: Add globalFunctionTimeout (#4985) @vasuvanka
- Exec: Make encoding handling consistent between stdout and err (#5158) @knolleary
- Split: Let split node send original msg to complete node (#5113) @dceejay
- Split: Rename Split The field (#5130) @dceejay
- MQTT: Ensure generated mqtt clientId uses only valid chars (#5156) @knolleary
- HTTP Request: Fix the capitisation for ALPN settings in http-request (#5105) @hardillb
- HTTP Request: (docs) Recommend HTTPS over HTTP (#5141) @ZJvandeWeg
- HTTP Request: Include URL query params in HTTP Digest (#5166) @hardillb
- Catch: Add code to error object sent by Catch node (#5081) @knolleary
- Debug: Improve debug display of error objects (#5079) @knolleary
#### 4.0.9: Maintenance Release
Editor

View File

@@ -133,7 +133,6 @@ module.exports = function(grunt) {
src: [
// Ensure editor source files are concatenated in
// the right order
"packages/node_modules/@node-red/editor-client/src/js/polyfills.js",
"packages/node_modules/@node-red/editor-client/src/js/jquery-addons.js",
"packages/node_modules/@node-red/editor-client/src/js/red.js",
"packages/node_modules/@node-red/editor-client/src/js/events.js",
@@ -215,9 +214,9 @@ module.exports = function(grunt) {
files: [
{
src: [
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-3.5.1.min.js",
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-migrate-3.3.0.min.js",
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui.min.js",
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-3.7.1.min.js",
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-migrate-3.5.2.min.js",
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui-1.14.1.min.js",
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js",
"node_modules/marked/marked.min.js",
"node_modules/dompurify/dist/purify.min.js",

101
README.md
View File

@@ -1,12 +1,44 @@
# Node-RED
<p align="center">
<a href="https://opensource.org/license/apache-2-0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg?color=3F51B5&style=for-the-badge&label=License&logoColor=000000&labelColor=ececec" alt="License: Apache 2.0"></a>
<a href="https://github.com/node-red/node-red/actions?query=branch%3Amaster">
<img src="https://img.shields.io/github/actions/workflow/status/node-red/node-red/tests.yml?branch=master&label=Build%20Status&style=for-the-badge" alt="Build Status"/>
</a>
<br/>
<br/>
<a href="https://discourse.nodered.org">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscourse.nodered.org%2Fabout.json&query=%24.about.stats.users_count&suffix=%20members&label=Forum&logo=discourse&style=for-the-badge&color=0e76b2&logoColor=0e76b2&labelColor=ececec" alt="Node-RED Forum on Discourse"/>
</a>
<a href="https://github.com/node-red">
<img src="https://img.shields.io/badge/dynamic/json?url=https://api.github.com/orgs/node-red&query=$.followers&suffix=%20followers&label=GitHub%20org&style=for-the-badge&logo=github&logoColor=24292F&labelColor=ececec&color=24292F" alt="Node-RED GitHub Organisation Followers"/>
</a>
<a href="https://nodered.org/slack">
<img src="https://img.shields.io/badge/Slack-Join%20Us-4A154B.svg?logo=slack&style=for-the-badge&logoColor=4A154B&labelColor=ececec" alt="Slack"/>
</a>
<br/>
<br/>
</p>
https://nodered.org
[![Build Status](https://github.com/node-red/node-red/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/node-red/node-red/actions?query=branch%3Amaster)
Low-code programming for event-driven applications.
![Node-RED: Low-code programming for event-driven applications](https://nodered.org/images/node-red-screenshot.png)
<p align="center">
<img src="https://nodered.org/about/resources/media/node-red-icon-2.svg" width="200" title="Node-RED Logo">
</p>
<h3 align="center">Low-code programming for event-driven applications</h3>
<br/>
<p align="center">
<a href="https://flows.nodered.org/search?type=node">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fflows.nodered.org%2Fthings%3Fformat%3Djson%26per_page%3D1%26type%3Dnode&query=$.meta.results.count&label=Nodes&style=for-the-badge&labelColor=ececec&color=8f0000" alt="Node-RED Library Nodes"/>
</a>
<a href="https://flows.nodered.org/search?type=flow">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fflows.nodered.org%2Fthings%3Fformat%3Djson%26per_page%3D1%26type%3Dflow&query=$.meta.results.count&label=Flows&style=for-the-badge&labelColor=ececec&color=8f0000" alt="Node-RED Library Flows"/>
</a>
<a href="https://flows.nodered.org/search?type=collection">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fflows.nodered.org%2Fthings%3Fformat%3Djson%26per_page%3D1%26type%3Dcollection&query=$.meta.results.count&label=Collections&style=for-the-badge&labelColor=ececec&color=8f0000" alt="Node-RED Library Collections"/>
</a>
</p>
<br/>
<a href="https://nodered.org/">
<img src="https://nodered.org/images/node-red-screenshot.png" title="Node-RED: Low-code programming for event-driven applications">
</a>
<br/>
## Quick Start
@@ -17,13 +49,25 @@ started.
2. `node-red`
3. Open <http://localhost:1880>
## Getting Help
<br/>
More documentation can be found [here](https://nodered.org/docs).
> [!NOTE]
> More documentation can be found [here](https://nodered.org/docs). For further help, or general discussion, please join the [Node-RED Forum](https://discourse.nodered.org) or [Node-RED Slack](https://nodered.org/slack).
For further help, or general discussion, please use the [Node-RED Forum](https://discourse.nodered.org) or [slack team](https://nodered.org/slack).
## Links
## Developers
- [Documentation ↗](https://nodered.org/docs/)
- [About ↗](https://nodered.org/about/)
- [Installation ↗](https://nodered.org/#get-started)
- [Node-RED Library ↗](https://flows.nodered.org/)
- [Custom Nodes & Integrations ↗](https://flows.nodered.org/search?type=node)
- [Shared Flows ↗](https://flows.nodered.org/search?type=flow)
- [Node Collections ↗](https://flows.nodered.org/search?type=collection)
- [Development](#development)
- [Contributing](#contributing)
- [Copyright and license](#copyright-and-license)
## Development
If you want to run the latest code from git, here's how to get started:
@@ -46,24 +90,37 @@ If you want to run the latest code from git, here's how to get started:
## Contributing
Before raising a pull-request, please read our
[contributing guide](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md).
Before raising a pull-request, please read our [contributing guide](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md).
This project adheres to the [Contributor Covenant 1.4](http://contributor-covenant.org/version/1/4/).
By participating, you are expected to uphold this code. Please report unacceptable
behavior to any of the project's core team at team@nodered.org.
This project adheres to the [Contributor Covenant 1.4](http://contributor-covenant.org/version/1/4/). By participating, you are expected to uphold this code. Please report unacceptable behavior to any of the project's core team at team@nodered.org.
## Authors
### Star history
Node-RED is a project of the [OpenJS Foundation](http://openjsf.org).
<a href="https://star-history.com/#node-red/node-red&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=node-red/node-red&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=node-red/node-red&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=node-red/node-red&type=Date" width="100%" />
</picture>
</a>
### Contributors
It is maintained by:
* Nick O'Leary [@knolleary](http://twitter.com/knolleary)
* Dave Conway-Jones [@ceejay](http://twitter.com/ceejay)
* And many others...
* And many others:
<a href="https://github.com/node-red/node-red/graphs/contributors">
<img src="https://contrib.rocks/image?repo=node-red/node-red" width="100%"/>
</a>
## Copyright and license
## Copyright and License
Copyright OpenJS Foundation and other contributors, https://openjsf.org under [the Apache 2.0 license](LICENSE).
Node-RED is a project of the [OpenJS Foundation](http://openjsf.org). Copyright OpenJS Foundation and other contributors, https://openjsf.org under [the Apache 2.0 license](LICENSE).
<br/>
<a href="http://openjsf.org">
<img src="https://raw.githubusercontent.com/node-red/community-survey/refs/heads/main/public/openjs-foundation-logo.svg" width="240" title="OpenJS Foundation Logo">
</a>

View File

@@ -3,3 +3,9 @@
## Reporting a Vulnerability
Please report any potential security issues to `team@nodered.org`. This will notify the core project team who will respond accordingly.
## Escalation
If you do not receive an acknowledgement of your report within 6 business days, or if you cannot find a private security contact for the project, you may escalate to the OpenJS Foundation CNA at `security@lists.openjsf.org`.
If the project acknowledges your report but does not provide any further response or engagement within 14 days, escalation is also appropriate.

View File

@@ -1,6 +1,6 @@
{
"name": "node-red",
"version": "4.0.9",
"version": "4.1.1",
"description": "Low-code programming for event-driven applications",
"homepage": "https://nodered.org",
"license": "Apache-2.0",
@@ -26,13 +26,14 @@
}
],
"dependencies": {
"acorn": "8.14.1",
"acorn": "8.15.0",
"acorn-walk": "8.3.4",
"ajv": "8.17.1",
"async-mutex": "0.5.0",
"basic-auth": "2.0.1",
"bcryptjs": "3.0.2",
"body-parser": "1.20.3",
"chalk": "^4.1.2",
"cheerio": "1.0.0-rc.10",
"clone": "2.1.2",
"content-type": "1.0.5",
@@ -41,9 +42,9 @@
"cors": "2.8.5",
"cronosjs": "1.7.1",
"denque": "2.1.0",
"express": "4.21.2",
"express-session": "1.18.1",
"form-data": "4.0.2",
"express": "4.22.1",
"express-session": "1.18.2",
"form-data": "4.0.4",
"fs-extra": "11.3.0",
"got": "12.6.1",
"hash-sum": "2.0.0",
@@ -62,13 +63,13 @@
"moment": "2.30.1",
"moment-timezone": "0.5.48",
"mqtt": "5.11.0",
"multer": "1.4.5-lts.2",
"multer": "2.0.2",
"mustache": "4.2.0",
"node-red-admin": "^4.0.2",
"node-red-admin": "^4.1.2",
"node-watch": "0.7.4",
"nopt": "5.0.0",
"oauth2orize": "1.12.0",
"on-headers": "1.0.2",
"on-headers": "1.1.0",
"passport": "0.7.0",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
@@ -86,7 +87,7 @@
"@node-rs/bcrypt": "1.10.7"
},
"devDependencies": {
"dompurify": "2.5.8",
"dompurify": "3.2.6",
"grunt": "1.6.1",
"grunt-chmod": "~1.1.1",
"grunt-cli": "~1.5.0",
@@ -110,7 +111,7 @@
"jquery-i18next": "1.2.1",
"jsdoc-nr-template": "github:node-red/jsdoc-nr-template",
"marked": "4.3.0",
"mermaid": "11.6.0",
"mermaid": "11.9.0",
"minami": "1.2.3",
"mocha": "9.2.2",
"node-red-node-test-helper": "^0.3.3",

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/editor-api",
"version": "4.0.9",
"version": "4.1.1",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@@ -16,17 +16,17 @@
}
],
"dependencies": {
"@node-red/util": "4.0.9",
"@node-red/editor-client": "4.0.9",
"@node-red/util": "4.1.1",
"@node-red/editor-client": "4.1.1",
"bcryptjs": "3.0.2",
"body-parser": "1.20.3",
"clone": "2.1.2",
"cors": "2.8.5",
"express-session": "1.18.1",
"express": "4.21.2",
"express-session": "1.18.2",
"express": "4.22.1",
"memorystore": "1.6.7",
"mime": "3.0.0",
"multer": "1.4.5-lts.2",
"multer": "2.0.2",
"mustache": "4.2.0",
"oauth2orize": "1.12.0",
"passport-http-bearer": "1.0.1",

View File

@@ -111,6 +111,7 @@
"userSettings": "User Settings",
"nodes": "Nodes",
"displayStatus": "Show node status",
"displayInfoIcon": "Show node information icon",
"displayConfig": "Configuration nodes",
"import": "Import",
"importExample": "Import example flow",
@@ -163,6 +164,7 @@
}
},
"actions": {
"open-event-log": "Open event log",
"toggle-navigator": "Toggle navigator",
"zoom-out": "Zoom out",
"zoom-reset": "Reset zoom",
@@ -264,6 +266,8 @@
"download": "Download",
"importUnrecognised": "Imported unrecognised type:",
"importUnrecognised_plural": "Imported unrecognised types:",
"importWithModuleInfo": "Required modules missing",
"importWithModuleInfoDesc": "These nodes are not currently installed in your palette and are required for the imported flow:",
"importDuplicate": "Imported duplicate node:",
"importDuplicate_plural": "Imported duplicate nodes:",
"nodesExported": "Nodes exported to clipboard",
@@ -570,6 +574,7 @@
"filter": "filter nodes",
"search": "search modules",
"addCategory": "Add new...",
"loadingSuggestions": "Loading suggestions...",
"label": {
"subflows": "subflows",
"network": "network",
@@ -623,12 +628,15 @@
"yearsMonthsV": "__y__ years, __count__ month ago",
"yearsMonthsV_plural": "__y__ years, __count__ months ago"
},
"manageModules": "Manage modules",
"nodeCount": "__label__ node",
"nodeCount_plural": "__label__ nodes",
"pluginCount": "__count__ plugin",
"pluginCount_plural": "__count__ plugins",
"moduleCount": "__count__ module available",
"moduleCount_plural": "__count__ modules available",
"updateCount": "__count__ update available",
"updateCount_plural": "__count__ updates available",
"inuse": "in use",
"enableall": "enable all",
"disableall": "disable all",
@@ -638,9 +646,12 @@
"update": "update to __version__",
"updated": "updated",
"install": "install",
"installAll": "Install all",
"installed": "installed",
"installing": "Module installation in progress: __module__",
"conflict": "conflict",
"conflictTip": "<p>This module cannot be installed as it includes a<br/>node type that has already been installed</p><p>Conflicts with <code>__module__</code></p>",
"majorVersion": "<p>This is a major version update of the node. Check the documentation for details of the update.</p>",
"loading": "Loading catalogues...",
"tab-nodes": "Nodes",
"tab-install": "Install",
@@ -648,9 +659,12 @@
"sortRelevance": "relevance",
"sortAZ": "a-z",
"sortRecent": "recent",
"successfulInstall": "Successfully installed modules",
"more": "+ __count__ more",
"upload": "Upload module tgz file",
"refresh": "Refresh module list",
"deprecated": "deprecated",
"deprecatedTip": "This module has been deprecated",
"errors": {
"catalogLoadFailed": "<p>Failed to load node catalogue.</p><p>Check the browser console for more information</p>",
"installFailed": "<p>Failed to install: __module__</p><p>__message__</p><p>Check the log for more information</p>",
@@ -1273,5 +1287,15 @@
"environment": "Environment",
"header": "Global Environment Variables",
"revert": "Revert"
},
"telemetry": {
"label": "Update Notifications",
"settingsTitle": "Enable Update Notifications",
"settingsDescription": "<p>Node-RED can notify you when there is a new version available. This ensures you keep up to date with the latest features and fixes.</p><p>This requires sending anonymised data back to the Node-RED team. It does not include any details of your flows or users.</p><p>For full information on what information is collected and how it is used, please see the <a href=\"https://nodered.org/docs/telemetry\" target=\"_blank\">documentation</a>.</p>",
"settingsDescription2": "<p>You can change this setting at any time in the User Settings.</p>",
"enableLabel": "Yes, enable notifications",
"disableLabel": "No, do not enable notifications",
"updateAvailable": "Update available",
"updateAvailableDesc": "Node-RED __version__ is now available"
}
}

View File

@@ -6,7 +6,7 @@
"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",
"tip6": "Move the selected nodes using the [left] [up] [down] and [right] keys whilst holding [ctrl]. 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}}",

View File

@@ -111,6 +111,7 @@
"userSettings": "Ajustes de usuario",
"nodes": "Nodos",
"displayStatus": "Mostrar estado del nodo",
"displayInfoIcon": "Mostrar icono de información del nodo",
"displayConfig": "Nodos de configuración",
"import": "Importar",
"importExample": "Importar flujo de ejemplo",
@@ -163,6 +164,7 @@
}
},
"actions": {
"open-event-log": "Abrir log eventos",
"toggle-navigator": "Alternar navegador",
"zoom-out": "Alejar",
"zoom-reset": "Restablecer zoom",
@@ -264,6 +266,8 @@
"download": "Descargar",
"importUnrecognised": "Tipo importado no reconocido:",
"importUnrecognised_plural": "Tipos importados no reconocidos:",
"importWithModuleInfo": "Faltan los módulos necesarios",
"importWithModuleInfoDesc": "Estos nodos no están instalados actualmente en tu paleta y son necesarios para el flujo importado:",
"importDuplicate": "Nodo duplicado importado:",
"importDuplicate_plural": "Nodos duplicados importados:",
"nodesExported": "Nodos exportados al portapapeles",
@@ -429,16 +433,16 @@
"remove": "Eliminar variable de entorno"
},
"errors": {
"noNodesSelected": "<strong>Cannot create subflow</strong>: no nodes selected",
"acrossMultipleGroups": "Cannot create subflow across multiple groups",
"multipleInputsToSelection": "<strong>Cannot create subflow</strong>: multiple inputs to selection"
"noNodesSelected": "<strong>No se puede crear un subflujo</strong>: no hay nodos seleccionados",
"acrossMultipleGroups": "No se puede crear un subflujo en varios grupos",
"multipleInputsToSelection": "<strong>No se puede crear un subflujo</strong>: hay varias entradas en la selección"
}
},
"group": {
"editGroup": "Editar grupo: __name__",
"errors": {
"cannotCreateDiffGroups": "Cannot create group using nodes from different groups",
"cannotAddSubflowPorts": "Cannot add subflow ports to a group"
"cannotCreateDiffGroups": "No se puede crear un grupo con nodos de diferentes grupos",
"cannotAddSubflowPorts": "No se pueden agregar puertos de subflujo a un grupo"
}
},
"editor": {
@@ -570,6 +574,7 @@
"filter": "filtrar nodos",
"search": "buscar módulos",
"addCategory": "Añadir nueva...",
"loadingSuggestions": "Cargando sugerencias...",
"label": {
"subflows": "subflujos",
"network": "red",
@@ -623,12 +628,15 @@
"yearsMonthsV": "hace __y__ años y __count__ mes",
"yearsMonthsV_plural": "hace __y__ años y __count__ meses"
},
"manageModules": "Administrar módulos",
"nodeCount": "__label__ nodo",
"nodeCount_plural": "__label__ nodos",
"pluginCount": "__count__ extensión",
"pluginCount_plural": "__count__ extensiones",
"moduleCount": "__count__ módulo disponible",
"moduleCount_plural": "__count__ módulos disponibles",
"updateCount": "__count__ actualización disponible",
"updateCount_plural": "__count__ actualizaciones disponibles",
"inuse": "en uso",
"enableall": "habilitar todo",
"disableall": "deshabilitar todo",
@@ -638,9 +646,12 @@
"update": "actualizar a __version__",
"updated": "actualizado",
"install": "instalar",
"installAll": "Instalar todo",
"installed": "instalado",
"installing": "Instalación del módulo en curso: __module__",
"conflict": "conflicto",
"conflictTip": "<p>Este módulo no puede ser instalado debido a que incluye un<br/> tipo de nodo que ya ha sido instalado</p><p>Conflictos con <code>__module__</code></p>",
"majorVersion": "<p>Esta es una actualización de la versión principal del nodo. Consulta la documentación para obtener más detalles sobre la actualización.</p>",
"loading": "Cargando catálogos...",
"tab-nodes": "Nodos",
"tab-install": "Instalar",
@@ -648,9 +659,12 @@
"sortRelevance": "relevancia",
"sortAZ": "a-z",
"sortRecent": "reciente",
"successfulInstall": "Módulos instalados correctamente",
"more": "+ __count__ más",
"upload": "Cargar módulo en archivo tgz",
"refresh": "Actualizar lista de módulos",
"deprecated": "obsoleto",
"deprecatedTip": "Este módulo ha quedado obsoleto",
"errors": {
"catalogLoadFailed": "<p>La carga del catálogo de nodos ha fallado</p><p>Revise la consola del navegador para mas información</p>",
"installFailed": "<p>Fallo al instalar: __module__</p><p>__message__</p><p>Revise el log para mas información</p>",
@@ -1273,5 +1287,15 @@
"environment": "Entorno",
"header": "Variables Globales de Entorno",
"revert": "Revertir"
},
"telemetry": {
"label": "Notificaciones de actualización",
"settingsTitle": "Habilitar notificaciones de actualización",
"settingsDescription": "<p>Node-RED puede notificarte cuando haya una nueva versión disponible. Esto te garantiza mantenerte al día con las últimas funciones y correcciones.</p><p>Esto requiere enviar datos anónimos al equipo de Node-RED. No incluye detalles de tus flujos ni usuarios.</p><p>Para obtener información completa sobre qué información se recopila y cómo se utiliza, consulta la <a href=\"https://nodered.org/docs/telemetry\" target=\"_blank\">documentación</a>.</p>",
"settingsDescription2": "<p>Puedes cambiar esta configuración en cualquier momento en la Configuración de usuario.</p>",
"enableLabel": "Sí, habilitar notificaciones",
"disableLabel": "No, no habilitar notificaciones",
"updateAvailable": "Actualización disponible",
"updateAvailableDesc": "Node-RED __version__ ya está disponible"
}
}

View File

@@ -6,7 +6,7 @@
"tip3": "Puedes gestionar tu paleta de nodos con {{core:manage-palette}}",
"tip4": "Tus nodos de configuración de flujo aparecen en el panel de la barra lateral. Se puede acceder desde el menú o con {{core:show-config-tab}}",
"tip5": "Activa o desactiva estos consejos desde la opción en la configuración",
"tip6": "Mueve los nodos seleccionados usando las teclas [izquierda] [arriba] [abajo] y [derecha]. Mantén pulsada [Mayús] para desplazarlos más",
"tip6": "Mueve los nodos seleccionados usando las teclas [left] [up] [down] y [right]. Mantén pulsada [shift] para desplazarlos más",
"tip7": "Arrastrar un nodo a un cable lo insertará en el enlace",
"tip8": "Exporta los nodos seleccionados, o la pestaña actual con {{core:show-export-dialog}}",
"tip9": "Importa un flujo arrastrando su JSON al editor, o con {{core:show-import-dialog}}",
@@ -21,6 +21,3 @@
"tip18": "Al pulsar {{core:edit-selected-node}} se editará el primer nodo de la selección actual"
}
}

View File

@@ -111,6 +111,7 @@
"userSettings": "Paramètres de l'utilisateur",
"nodes": "Noeuds",
"displayStatus": "Afficher l'état du noeud",
"displayInfoIcon": "Afficher l'icône d'information sur le noeud",
"displayConfig": "Noeuds de configuration",
"import": "Importer",
"importExample": "Importer un exemple de flux",
@@ -264,6 +265,8 @@
"download": "Télécharger",
"importUnrecognised": "Importation d'un type inconnu :",
"importUnrecognised_plural": "Importation de plusieurs types inconnus :",
"importWithModuleInfo": "Modules requis manquants",
"importWithModuleInfoDesc": "Ces noeuds ne sont pas actuellement installés dans votre palette et sont requis pour le flux importé :",
"importDuplicate": "Noeud en double importé :",
"importDuplicate_plural": "Noeuds en double importés :",
"nodesExported": "Noeuds exportés vers le presse-papiers",
@@ -623,12 +626,15 @@
"yearsMonthsV": "il y a __y__ ans, __count__ mois",
"yearsMonthsV_plural": "il y a __y__ ans, __count__ mois"
},
"manageModules": "Gérer les modules",
"nodeCount": "__label__ noeud",
"nodeCount_plural": "__label__ noeuds",
"pluginCount": "__count__ plugin",
"pluginCount_plural": "__count__ plugins",
"moduleCount": "__count__ module disponible",
"moduleCount_plural": "__count__ modules disponibles",
"updateCount": "__count__ mise à jour disponible",
"updateCount_plural": "__count__ mises à jour disponibles",
"inuse": "En cours d'utilisation",
"enableall": "Activer tout",
"disableall": "Désactiver tout",
@@ -638,9 +644,12 @@
"update": "Mettre à jour vers __version__",
"updated": "Mis à jour",
"install": "Installer",
"installAll": "Installer tout",
"installed": "Installé",
"installing": "Installation du module en cours : __module__",
"conflict": "Conflit",
"conflictTip": "<p>Ce module ne peut pas être installé car il inclut un<br/>type de noeud qui a déjà été installé</p><p>Conflits avec <code>__module__</code></p>",
"majorVersion": "<p>Il s'agit d'une mise à jour majeure du noeud. Consulter la documentation pour plus de détails sur la mise à jour.</p>",
"loading": "Chargement des catalogues...",
"tab-nodes": "Noeuds",
"tab-install": "Installer",
@@ -648,9 +657,12 @@
"sortRelevance": "Pertinence",
"sortAZ": "A-Z",
"sortRecent": "Récent",
"successfulInstall": "Modules installés avec succès",
"more": "+ __count__ en plus",
"upload": "Charger le fichier .tgz du module",
"refresh": "Actualiser la liste des modules",
"deprecated": "Obsolète",
"deprecatedTip": "Ce module est obsolète",
"errors": {
"catalogLoadFailed": "<p>Échec du chargement du catalogue de noeuds.</p><p>Vérifier la console du navigateur pour plus d'informations</p>",
"installFailed": "<p>Échec lors de l'installation : __module__</p><p>__message__</p><p>Consulter le journal pour plus d'informations</p>",
@@ -1262,6 +1274,16 @@
"header": "Variables d'environnement globales",
"revert": "Rétablir"
},
"telemetry": {
"label": "Notifications de mise à jour",
"settingsTitle": "Activer les notifications de mise à jour",
"settingsDescription": "<p>Node-RED peut vous avertir de la disponibilité d'une nouvelle version. Vous êtes ainsi informé des dernières fonctionnalités et correctifs.</p><p>Cela nécessite d'envoyer des données anonymes à l'équipe Node-RED. Elles n'incluent aucun détail sur vos flux ou vos utilisateurs.</p><p>Pour plus d'informations sur les informations collectées et leur utilisation, veuillez consulter la <a href=\"https://nodered.org/docs/telemetry\" target=\"_blank\">documentation</a>.</p>",
"settingsDescription2": "<p>Vous pouvez modifier ce paramètre à tout moment dans les paramètres de l'utilisateur.</p>",
"enableLabel": "Oui, activer les notifications",
"disableLabel": "Non, ne pas activer les notifications",
"updateAvailable": "Mise(s) à jour disponible(s)",
"updateAvailableDesc": "Node-RED __version__ est désormais disponible"
},
"action-list": {
"toggle-show-tips": "Basculer l'affichage des astuces",
"show-about": "Afficher la description de Node-RED",

View File

@@ -6,7 +6,7 @@
"tip3": "Vous pouvez gérer votre palette de noeuds avec {{core:manage-palette}}",
"tip4": "Vos noeuds de configuration de flux sont répertoriés dans le panneau de la barre latérale. Ils sont accessibles depuis le menu ou avec {{core:show-config-tab}}",
"tip5": "Activer ou désactiver ces conseils à partir de l'option dans les paramètres",
"tip6": "Déplacer les noeuds sélectionnés à l'aide des touches [gauche] [haut] [bas] et [droite]. Maintenir la touche [shift] enfoncée pour les pousser plus loin",
"tip6": "Déplacer les noeuds sélectionnés à l'aide des touches [left] [up] [down] et [right]. Maintenir la touche [shift] enfoncée pour les pousser plus loin",
"tip7": "Faire glisser un noeud sur un fil le raccordera au lien",
"tip8": "Exporter les noeuds sélectionnés, ou l'onglet actuel avec {{core:show-export-dialog}}",
"tip9": "Importer un flux en faisant glisser son JSON dans l'éditeur, ou avec {{core:show-import-dialog}}",

View File

@@ -111,6 +111,7 @@
"userSettings": "ユーザ設定",
"nodes": "ノード",
"displayStatus": "ノードのステータスを表示",
"displayInfoIcon": "ノード情報のアイコンを表示",
"displayConfig": "設定ノード",
"import": "読み込み",
"importExample": "フロー例を読み込み",
@@ -163,6 +164,7 @@
}
},
"actions": {
"open-event-log": "イベントログを開く",
"toggle-navigator": "ナビゲータの表示/非表示を切替",
"zoom-out": "縮小",
"zoom-reset": "拡大/縮小を初期化",
@@ -264,6 +266,8 @@
"download": "ダウンロード",
"importUnrecognised": "認識できない型が読み込まれました:",
"importUnrecognised_plural": "認識できない型が読み込まれました:",
"importWithModuleInfo": "必要なモジュールが不足",
"importWithModuleInfoDesc": "以下のノードは現在パレットにインストールされていませんが、読み込んだフローには必要なノードです:",
"importDuplicate": "重複したノードを読み込みました:",
"importDuplicate_plural": "重複したノードを読み込みました:",
"nodesExported": "クリップボードへフローを書き出しました",
@@ -570,6 +574,7 @@
"filter": "ノードを検索",
"search": "ノードを検索",
"addCategory": "新規追加...",
"loadingSuggestions": "提案を読み込み中...",
"label": {
"subflows": "サブフロー",
"network": "ネットワーク",
@@ -623,12 +628,15 @@
"yearsMonthsV": "__y__ 年 __count__ ヵ月前",
"yearsMonthsV_plural": "__y__ 年 __count__ ヵ月前"
},
"manageModules": "モジュールを管理",
"nodeCount": "__label__ 個のノード",
"nodeCount_plural": "__label__ 個のノード",
"pluginCount": "__count__ 個のプラグイン",
"pluginCount_plural": "__count__ 個のプラグイン",
"moduleCount": "__count__ 個のモジュール",
"moduleCount_plural": "__count__ 個のモジュール",
"updateCount": "__count__ 個の更新が存在",
"updateCount_plural": "__count__ 個の更新が存在",
"inuse": "使用中",
"enableall": "全て有効化",
"disableall": "全て無効化",
@@ -638,9 +646,12 @@
"update": "__version__ へ更新",
"updated": "更新済",
"install": "ノードを追加",
"installAll": "全てインストール",
"installed": "追加しました",
"installing": "モジュールのインストールが進行中: __module__",
"conflict": "競合",
"conflictTip": "<p>インストール済みのノードの種別と競合しているため<br/>ノードをインストールできません</p><p>競合: <code>__module__</code></p>",
"majorVersion": "<p>これはノードのメジャーバージョンの更新です。更新内容の詳細については、ドキュメントを確認してください。</p>",
"loading": "カタログを読み込み中",
"tab-nodes": "現在のノード",
"tab-install": "ノードを追加",
@@ -648,9 +659,12 @@
"sortRelevance": "関連順",
"sortAZ": "辞書順",
"sortRecent": "日付順",
"successfulInstall": "モジュールのインストールが成功",
"more": "+ さらに __count__ 個",
"upload": "モジュールのtgzファイルをアップロード",
"refresh": "モジュールリスト更新",
"deprecated": "非推奨",
"deprecatedTip": "本モジュールは非推奨です",
"errors": {
"catalogLoadFailed": "<p>ノードのカタログの読み込みに失敗しました。</p><p>詳細はブラウザのコンソールを確認してください。</p>",
"installFailed": "<p>追加処理が失敗しました: __module__</p><p>__message__</p><p>詳細はログを確認してください。</p>",
@@ -1262,6 +1276,16 @@
"header": "グローバル環境変数",
"revert": "破棄"
},
"telemetry": {
"label": "更新の通知",
"settingsTitle": "更新の通知を有効化",
"settingsDescription": "<p>新バージョンのNode-REDが存在した時に、通知を受けることができます。この機能によって最新機能の提供や修正があることを把握できます。</p><p>この通知を受け取るには、匿名化されたデータをNode-REDチームに送る必要があります。このデータには、フローやユーザの詳細は含まれません。</p><p>収集される情報と利用方法の詳細については、<a href=\"https://nodered.org/docs/telemetry\" target=\"_blank\">ドキュメント</a>を参照してください。</p>",
"settingsDescription2": "<p>この設定はユーザ設定からいつでも変更できます。</p>",
"enableLabel": "はい、通知を有効にします",
"disableLabel": "いいえ、通知を有効にしません",
"updateAvailable": "更新を利用可能",
"updateAvailableDesc": "現在、Node-RED __version__ が利用可能"
},
"action-list": {
"toggle-show-tips": "ヒント表示切替",
"show-about": "Node-REDの説明を表示",
@@ -1302,6 +1326,7 @@
"toggle-show-grid": "グリッド表示切替",
"toggle-snap-grid": "ノードの配置補助切替",
"toggle-status": "ステータス表示切替",
"toggle-node-info-icon": "ノード情報のアイコン表示切替",
"show-selected-node-labels": "選択したノードのラベルを表示",
"hide-selected-node-labels": "選択したノードのラベルを非表示",
"scroll-view-up": "上スクロール",
@@ -1414,6 +1439,7 @@
"show-global-env": "グローバル環境変数を表示",
"lock-flow": "フローを固定",
"unlock-flow": "フローの固定を解除",
"show-node-help": "ノードのヘルプを表示"
"show-node-help": "ノードのヘルプを表示",
"trigger-selected-nodes-action": "選択したノードのアクションを実行"
}
}

View File

@@ -6,15 +6,15 @@
"tip3" : "Вы можете управлять палитрой узлов с помощью {{core:manage-palette}}",
"tip4" : "Узлы конфигурации потока перечисляются на боковой панели. Доступ к списку можно получить из меню или с помощью {{core:show-config-tab}}",
"tip5" : "Эти советы можно включить/выключить через настройки",
"tip6" : "Перемещайте выбранные узлы клавишами [влево] [вверх] [вниз] и [вправо]. Удерживайте [Shift], чтобы увеличить шаг",
"tip6" : "Перемещайте выбранные узлы клавишами [left] [up] [down] и [right]. Удерживайте [shift], чтобы увеличить шаг",
"tip7" : "Перетаскивание узла на провод соединит его с обеих сторон",
"tip8" : "Экспортируйте выбранные узлы или текущую вкладку с {{core:show-export-dialog}}",
"tip9" : "Импортируйте поток, перетаскивая его JSON в редактор или с помощью {{core:show-import-dialog}}",
"tip10" : "Нажмите [Shift], [кликните] по порту узла и перетаскивайте подключенные провода на другой узел",
"tip10" : "Нажмите [shift], [кликните] по порту узла и перетаскивайте подключенные провода на другой узел",
"tip11" : "Открывайте вкладку Информация с {{core:show-info-tab}} или вкладку Отладка с {{core:show-debug-tab}}",
"tip12" : "Нажмите [ctrl] и [кликните] в рабочей области, чтобы открыть диалог быстрого добавления",
"tip13" : "Нажмите [ctrl] и [кликните] по порту узла, чтобы начать быстрое подключение",
"tip14" : "Нажмите [Shift] и [кликните] по узлу, чтобы выбрать все соединенные узлы",
"tip14" : "Нажмите [shift] и [кликните] по узлу, чтобы выбрать все соединенные узлы",
"tip15" : "Нажмите [ctrl] и [кликните] по узлу, чтобы добавить или убрать его из текущего выбора",
"tip16" : "Переключайте вкладки потока с помощью {{core:show-previous-tab}} и {{core:show-next-tab}}",
"tip17" : "Вы можете подтвердить изменения в редакторе узла с {{core:confirm-edit-tray}} или отменить их с {{core:cancel-edit-tray}}",

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/editor-client",
"version": "4.0.9",
"version": "4.1.1",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@@ -1 +1,20 @@
<svg width="46.994" height="18.006" xmlns="http://www.w3.org/2000/svg"><g stroke="#d6d6d6"><g fill="#9e3131" stroke-linejoin="round" stroke-width="3.847" transform="matrix(.25848 0 0 .2614 -63.87 -108.483)"><rect x="249.04" y="435.92" width="50.294" height="22.953" ry="6.608"/><rect x="345.63" y="416.93" width="50.294" height="22.953" ry="6.608"/><rect x="376.71" y="459.01" width="50.294" height="22.953" ry="6.608"/></g><path d="M301.04 447.43c24.406.184 7.107-18.84 42.708-19.03M374.82 470.48c-46.966.538-28.989-22.664-73.619-22.944" fill="none" stroke-width="5.771" transform="matrix(.25848 0 0 .2614 -63.87 -108.483)"/></g></svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" height="647" width="560" version="1.1" xmlns:cc="http://creativecommons.org/ns#" viewBox="0 0 560.00001 647.00001" xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g transform="translate(0 -405.36)">
<g transform="translate(.000014172 .000022107)">
<path opacity="0.98" style="color-rendering:auto;color:#000000;isolation:auto;mix-blend-mode:normal;shape-rendering:auto;solid-color:#000000;image-rendering:auto" d="m280 405.36 280 162.03v323.32l-280 161.69-280-161.7-0.0000055092-323.41z" fill="#8f0000"/>
<path d="m278.57 1019.5-28.122-14.758-219.32-239.19 3.8673-12.478h107.86l19.715-65.534 17.337 24.866 57.948-65.047 47.857-12.857 2.1429 33.571 33.571 3.5714 33.571 0.7143 87.143 2.1428 14.96-70.328 74.709 87.705-2.0935 65.238-115.11 0.0298-1.9844 60.416 120.23 12.653 1.4251 42.694z" fill-opacity=".19898" fill-rule="evenodd"/>
<path opacity="0.98" style="color-rendering:auto;text-decoration-color:#000000;color:#000000;isolation:auto;mix-blend-mode:normal;shape-rendering:auto;solid-color:#000000;block-progression:tb;text-decoration-line:none;text-decoration-style:solid;image-rendering:auto;white-space:normal;text-indent:0;text-transform:none" d="m21.75 766.85v108.15c-0.000146 1.7862 0.95284 3.4368 2.5 4.3301l253.25 145.97c1.5471 0.8927 3.4529 0.8927 5 0l252.86-145.98c1.5472-0.8933 2.6427-2.5439 2.6426-4.3301v-35.361-22.285-50.504-22.281-161.46c0.00015-1.7862-1.0954-3.4368-2.6426-4.3301l-252.86-145.95c-0.72594-0.41802-1.5453-0.64704-2.3828-0.66602-0.91698-0.0221-1.8224 0.20827-2.6172 0.66602l-253.25 145.95c-1.5472 0.8933-2.5001 2.5439-2.5 4.3301v88.68 20.795 51.99zm258.25-323.93l248 143.06v158.38h-99.357c-17.583 0-32.643 14.683-32.643 32.267v4.3203c-59.713-0.44167-77.52-15.896-99.729-35.316-18.46-16.144-41.584-33.808-88.092-41.188 8.6712-8.6968 13.887-18.575 18.533-27.002 4.9936-9.0548 9.5102-16.227 16.734-21.184 5.6262-3.8616 15.231-6.1887 27.666-6.9277v4.0606c0 17.583 13.655 31.97 31.238 31.97h127.3c17.583 0 33.352-14.386 33.352-31.97v-31.279c0-17.583-15.706-31.75-33.289-31.75l-127.3-0.002c-17.583 0-31.301 14.167-31.301 31.75v5.7031c-16.445 0.81071-30.442 4.0316-39.949 10.557-11.762 8.0728-18.195 19.038-23.461 28.586-5.2657 9.5484-9.5828 17.764-15.855 23.518-5.3491 4.9052-12.841 8.2718-25.018 9.8086-1.5749-16.163-15.629-27.827-32.172-27.921h-102.66v-86.38zm22.414 169.44h127.3c5.9367 0 10.289 3.8124 10.289 9.7492v31.279c0 5.9367-4.415 9.9717-10.352 9.9716h-127.3c-5.9367 0-10.766-4.035-10.766-9.9716v-31.279c0-5.9367 4.8916-9.7492 10.828-9.7492zm-270.41 80h102.65c5.9367 0 10.348 4.9199 10.348 10.857v31.281c0 5.9367-4.411 9.8623-10.348 9.8622h-102.65zm135.44 30.243c71.712 1.1287 91.494 19.195 114.55 39.359 22.126 19.349 49.351 39.661 114.01 40.516v5.4297c0 17.583 15.059 31.452 32.643 31.452h99.357v32.747l-248 143.09-248-143.09v-105.75h102.66c17.583 0 32.777-14.277 32.777-31.86zm261.21 43.757h99.355v51h-99.355c-5.9367 0-10.645-4.0661-10.645-10.003v-30.73c0-5.9367 4.7078-10.267 10.645-10.267z" fill="#fff"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -116,7 +116,13 @@ RED.comms = (function() {
var subscribers = subscriptions[t];
if (subscribers) {
for (var i=0;i<subscribers.length;i++) {
subscribers[i](msg.topic,msg.data);
try {
subscribers[i](msg.topic,msg.data);
} catch (error) {
// need to decide what to do with this uncaught error
console.warn('Uncaught error from RED.comms.subscribe: ' + error.toString())
console.warn(error)
}
}
}
}

View File

@@ -514,7 +514,15 @@ RED.history = (function() {
}
}
}
if (ev.node.type === 'subflow') {
// Ensure ports get a refresh in case of a label change
if (ev.changes.inputLabels) {
ev.node.in.forEach(function(input) { input.dirty = true; });
}
if (ev.changes.outputLabels) {
ev.node.out.forEach(function(output) { output.dirty = true; });
}
}
ev.node.dirty = true;
ev.node.changed = ev.changed;
@@ -582,22 +590,23 @@ RED.history = (function() {
RED.editor.updateNodeProperties(n);
RED.editor.validateNode(n);
});
} else {
var outputMap;
if (ev.outputMap) {
outputMap = {};
inverseEv.outputMap = {};
for (var port in ev.outputMap) {
if (ev.outputMap.hasOwnProperty(port) && ev.outputMap[port] !== "-1") {
outputMap[ev.outputMap[port]] = port;
inverseEv.outputMap[ev.outputMap[port]] = port;
}
}
let outputMap;
if (ev.outputMap) {
outputMap = {};
inverseEv.outputMap = {};
for (var port in ev.outputMap) {
if (ev.outputMap.hasOwnProperty(port) && ev.outputMap[port] !== "-1") {
outputMap[ev.outputMap[port]] = port;
inverseEv.outputMap[ev.outputMap[port]] = port;
}
}
ev.node.__outputs = inverseEv.changes.outputs;
RED.editor.updateNodeProperties(ev.node,outputMap);
RED.editor.validateNode(ev.node);
}
ev.node.__outputs = inverseEv.changes.outputs;
RED.editor.updateNodeProperties(ev.node,outputMap);
RED.editor.validateNode(ev.node);
// If it's a Config Node, validate user nodes too.
// NOTE: The Config Node must be validated before validating users.
if (ev.node.users) {

View File

@@ -92,7 +92,6 @@
"ctrl-+": "core:zoom-in",
"ctrl--": "core:zoom-out",
"ctrl-0": "core:zoom-reset"
},
"red-ui-editor-stack": {
"ctrl-enter": "core:confirm-edit-tray",

View File

@@ -738,7 +738,7 @@ RED.nodes = (function() {
}
}
function addNode(n) {
function addNode(n, opt) {
let newNode
if (!n.__isProxy__) {
newNode = new Proxy(n, nodeProxyHandler)
@@ -777,7 +777,7 @@ RED.nodes = (function() {
nodeLinks[n.id] = {in:[],out:[]};
}
}
RED.events.emit('nodes:add',newNode);
RED.events.emit('nodes:add',newNode, opt);
return newNode
}
function addLink(l) {
@@ -1543,8 +1543,20 @@ RED.nodes = (function() {
}
/**
* Converts the current node selection to an exportable JSON Object
**/
function createExportableNodeSet(set, exportedIds, exportedSubflows, exportedConfigNodes) {
* @param {Array<Node>} set the node selection to export
* @param {Object} options
* @param {Record<string, boolean>} [options.exportedIds]
* @param {Record<string, boolean>} [options.exportedSubflows]
* @param {Record<string, boolean>} [options.exportedConfigNodes]
* @param {boolean} [options.includeModuleConfig]
* @returns {Array<Node>}
*/
function createExportableNodeSet(set, {
exportedIds,
exportedSubflows,
exportedConfigNodes,
includeModuleConfig = false
} = {}) {
var nns = [];
exportedIds = exportedIds || {};
@@ -1578,7 +1590,7 @@ RED.nodes = (function() {
subflowSet = subflowSet.concat(RED.nodes.junctions(subflowId))
subflowSet = subflowSet.concat(RED.nodes.groups(subflowId))
var exportableSubflow = createExportableNodeSet(subflowSet, exportedIds, exportedSubflows, exportedConfigNodes);
var exportableSubflow = createExportableNodeSet(subflowSet, { exportedIds, exportedSubflows, exportedConfigNodes });
nns = exportableSubflow.concat(nns);
}
}
@@ -1613,19 +1625,29 @@ RED.nodes = (function() {
}
nns.push(convertedNode);
if (node.type === "group") {
nns = nns.concat(createExportableNodeSet(node.nodes, exportedIds, exportedSubflows, exportedConfigNodes));
nns = nns.concat(createExportableNodeSet(node.nodes, { exportedIds, exportedSubflows, exportedConfigNodes }));
}
} else {
} else if (!node.direction) {
// node.direction indicates its a virtual subflow node (input/output/status) that cannot be
// exported so should be skipped over.
var convertedSubflow = convertSubflow(node, { credentials: false });
nns.push(convertedSubflow);
}
}
if (includeModuleConfig) {
updateGlobalConfigModuleList(nns)
}
return nns;
}
// Create the Flow JSON for the current configuration
// opts.credentials (whether to include (known) credentials) - default: true
// opts.dimensions (whether to include node dimensions) - default: false
/**
* Converts the current configuration to an exportable JSON Object
* @param {object} opts
* @param {boolean} [opts.credentials] whether to include (known) credentials. Default `true`.
* @param {boolean} [opts.dimensions] whether to include node dimensions. Default `false`.
* @param {boolean} [opts.includeModuleConfig] whether to include modules. Default `false`.
* @returns {Array<object>}
*/
function createCompleteNodeSet(opts) {
var nns = [];
var i;
@@ -1657,6 +1679,9 @@ RED.nodes = (function() {
RED.nodes.eachNode(function(n) {
nns.push(convertNode(n, opts));
})
if (opts?.includeModuleConfig) {
updateGlobalConfigModuleList(nns);
}
return nns;
}
@@ -1884,14 +1909,26 @@ RED.nodes = (function() {
* - id:import - import as-is
* - id:copy - import with new id
* - id:replace - import over the top of existing
* - modules: map of module:version - hints for unknown nodes
* - applyNodeDefaults - whether to apply default values to the imported nodes (default: false)
* - eventContext - context to include in the `nodes:add` event
*/
function importNodes(newNodesObj,options) { // createNewIds,createMissingWorkspace) {
const defOpts = { generateIds: false, addFlow: false, markChanged: false, reimport: false, importMap: {} }
const defOpts = {
generateIds: false,
addFlow: false,
markChanged: false,
reimport: false,
importMap: {},
applyNodeDefaults: false,
eventContext: null
}
options = Object.assign({}, defOpts, options)
options.importMap = options.importMap || {}
const createNewIds = options.generateIds;
const reimport = (!createNewIds && !!options.reimport)
const createMissingWorkspace = options.addFlow;
const applyNodeDefaults = options.applyNodeDefaults;
var i;
var n;
var newNodes;
@@ -2019,12 +2056,73 @@ RED.nodes = (function() {
}
if (!isInitialLoad && unknownTypes.length > 0) {
var typeList = $("<ul>");
unknownTypes.forEach(function(t) {
$("<li>").text(t).appendTo(typeList);
})
typeList = typeList[0].outerHTML;
RED.notify("<p>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</p>"+typeList,"error",false,10000);
const notificationOptions = {
type: "error",
fixed: false,
timeout: 10000,
}
let unknownNotification
let missingModules = []
if (options.modules) {
missingModules = Object.keys(options.modules).filter(module => !RED.nodes.registry.getModule(module))
}
if (missingModules.length > 0) {
notificationOptions.fixed = true
delete notificationOptions.timeout
// We have module hint list from imported global-config
// Provide option to install missing modules
notificationOptions.buttons = [
{
text: RED._("palette.editor.installAll"),
class: "primary",
click: function(e) {
unknownNotification.close();
RED.actions.invoke('core:manage-palette', {
autoInstall: true,
modules: missingModules.reduce((modules, moduleName) => {
modules[moduleName] = options.modules[moduleName];
return modules;
}, {}),
});
}
},
{
text: RED._("palette.editor.manageModules"),
class: "pull-left",
click: function(e) {
unknownNotification.close();
RED.actions.invoke('core:manage-palette', {
view: 'install',
filter: '"' + missingModules.join('", "') + '"'
});
}
}
]
let moduleList = $("<ul>");
missingModules.forEach(function(t) {
$("<li>").text(t).appendTo(moduleList);
})
moduleList = moduleList[0].outerHTML;
unknownNotification = RED.notify(
"<p>"+RED._("clipboard.importWithModuleInfo")+"</p>"+
"<p>"+RED._("clipboard.importWithModuleInfoDesc")+"</p>"+
moduleList,
notificationOptions
);
} else {
var typeList = $("<ul>");
unknownTypes.forEach(function(t) {
$("<li>").text(t).appendTo(typeList);
})
typeList = typeList[0].outerHTML;
unknownNotification = RED.notify(
"<p>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</p>"+typeList,
notificationOptions
);
}
}
var activeWorkspace = RED.workspaces.active();
@@ -2224,6 +2322,13 @@ RED.nodes = (function() {
for (d in def.defaults) {
if (def.defaults.hasOwnProperty(d)) {
configNode[d] = n[d];
if (applyNodeDefaults && n[d] === undefined) {
// If the node has a default value, but the imported node does not
// set it, then set it to the default value
if (def.defaults[d].value !== undefined) {
configNode[d] = JSON.parse(JSON.stringify(def.defaults[d].value))
}
}
configNode._config[d] = JSON.stringify(n[d]);
if (def.defaults[d].type) {
configNode._configNodeReferences.add(n[d])
@@ -2452,6 +2557,9 @@ RED.nodes = (function() {
delete node.z;
}
}
const unknownTypeDef = RED.nodes.getType('unknown')
node._def.oneditprepare = unknownTypeDef.oneditprepare
var orig = {};
for (var p in n) {
if (n.hasOwnProperty(p) && p!="x" && p!="y" && p!="z" && p!="id" && p!="wires") {
@@ -2461,6 +2569,10 @@ RED.nodes = (function() {
node._orig = orig;
node.name = n.type;
node.type = "unknown";
if (options.modules) {
// We have a module hint list. Attach to the unknown node so we can reference it later
node.modules = Object.keys(options.modules)
}
}
if (node._def.category != "config") {
if (n.hasOwnProperty('inputs') && node._def.defaults.hasOwnProperty("inputs")) {
@@ -2491,6 +2603,13 @@ RED.nodes = (function() {
for (d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d) && d !== 'inputs' && d !== 'outputs') {
node[d] = n[d];
if (applyNodeDefaults && n[d] === undefined) {
// If the node has a default value, but the imported node does not
// set it, then set it to the default value
if (node._def.defaults[d].value !== undefined) {
node[d] = JSON.parse(JSON.stringify(node._def.defaults[d].value))
}
}
node._config[d] = JSON.stringify(n[d]);
}
}
@@ -2678,7 +2797,7 @@ RED.nodes = (function() {
// Now the nodes have been fully updated, add them.
for (i=0;i<new_nodes.length;i++) {
new_nodes[i] = addNode(new_nodes[i])
new_nodes[i] = addNode(new_nodes[i], options.eventContext)
node_map[new_nodes[i].id] = new_nodes[i]
}
@@ -2744,7 +2863,8 @@ RED.nodes = (function() {
workspaces:new_workspaces,
subflows:new_subflows,
missingWorkspace: missingWorkspace,
removedNodes: removedNodes
removedNodes: removedNodes,
nodeMap: node_map
}
}
@@ -3148,6 +3268,44 @@ RED.nodes = (function() {
}
}
/**
* Gets the module list for the given nodes
* @param {Array<Node>} nodes the nodes to search in
* @returns {Record<string, string>} an object with {[moduleName]: moduleVersion}
*/
function getModuleListForNodes(nodes) {
const modules = {}
const typeSet = new Set()
nodes.forEach((n) => {
if (!typeSet.has(n.type)) {
typeSet.add(n.type)
const nodeSet = RED.nodes.registry.getNodeSetForType(n.type)
if (nodeSet) {
modules[nodeSet.module] = nodeSet.version
nodeSet.types.forEach((t) => typeSet.add(t))
}
}
})
return modules
}
function updateGlobalConfigModuleList(nodes) {
const modules = getModuleListForNodes(nodes)
delete modules['node-red']
const hasModules = (Object.keys(modules).length > 0)
let globalConfigNode = nodes.find((n) => n.type === 'global-config')
if (!globalConfigNode && hasModules) {
globalConfigNode = {
id: RED.nodes.id(),
type: 'global-config',
env: [],
modules
}
nodes.push(globalConfigNode)
} else if (hasModules) {
globalConfigNode.modules = modules
}
}
return {
init: function() {
RED.events.on("registry:node-type-added",function(type) {
@@ -3229,7 +3387,12 @@ RED.nodes = (function() {
});
RED.events.on('deploy', function () {
allNodes.clearState()
})
});
RED.actions.add("core:trigger-selected-nodes-action", function () {
const selectedNodes = RED.view.selection().nodes || [];
// Triggers the button action of the selected nodes
selectedNodes.forEach((node) => RED.view.clickNodeButton(node));
});
},
registry:registry,
setNodeList: registry.setNodeList,

View File

@@ -1,56 +0,0 @@
(function() {
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
if (isIE11) {
// IE11 DOMTokenList.toggle does not support the two-argument variety
window.DOMTokenList.prototype.toggle = function(cl,bo) {
if (arguments.length === 1) {
bo = !this.contains(cl);
}
this[!!bo?"add":"remove"](cl);
}
// IE11 does not provide classList on SVGElements
if (! ("classList" in SVGElement.prototype)) {
Object.defineProperty(SVGElement.prototype, 'classList', Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'classList'));
}
// IE11 does not provide children on SVGElements
if (! ("children" in SVGElement.prototype)) {
Object.defineProperty(SVGElement.prototype, 'children', Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'children'));
}
Array.from = function() {
if (arguments.length > 1) {
throw new Error("Node-RED's IE11 Array.from polyfill doesn't support multiple arguments");
}
var arrayLike = arguments[0]
var result = [];
if (arrayLike.forEach) {
arrayLike.forEach(function(i) {
result.push(i);
})
} else {
for (var i=0;i<arrayLike.length;i++) {
result.push(arrayList[i]);
}
}
return result;
}
if (new Set([0]).size === 0) {
// IE does not support passing an iterable to Set constructor
var _Set = Set;
/*global Set:true */
Set = function Set(iterable) {
var set = new _Set();
if (iterable) {
iterable.forEach(set.add, set);
}
return set;
};
Set.prototype = _Set.prototype;
Set.prototype.constructor = Set;
}
}
})();

View File

@@ -358,7 +358,10 @@ var RED = (function() {
});
return;
}
if (notificationId === "update-available") {
// re-emit as an event to be handled in editor-client/src/js/ui/palette-editor.js
RED.events.emit("notification/update-available", msg)
}
if (msg.text) {
msg.default = msg.text;
var text = RED._(msg.text,msg);
@@ -672,14 +675,48 @@ var RED = (function() {
setTimeout(function() {
loader.end();
checkFirstRun(function() {
if (showProjectWelcome) {
RED.projects.showStartup();
}
});
checkTelemetry(function () {
checkFirstRun(function() {
if (showProjectWelcome) {
RED.projects.showStartup();
}
});
})
},100);
}
function checkTelemetry(done) {
const telemetrySettings = RED.settings.telemetryEnabled;
// Can only get telemetry permission from a user with permission to modify settings
if (RED.user.hasPermission("settings.write") && telemetrySettings === undefined) {
const dialog = RED.popover.dialog({
title: RED._("telemetry.settingsTitle"),
content: `${RED._("telemetry.settingsDescription")}${RED._("telemetry.settingsDescription2")}`,
closeButton: false,
buttons: [
{
text: RED._("telemetry.enableLabel"),
click: () => {
RED.settings.set("telemetryEnabled", true)
dialog.close()
done()
}
},
{
text: RED._("telemetry.disableLabel"),
click: () => {
RED.settings.set("telemetryEnabled", false)
dialog.close()
done()
}
}
]
})
} else {
done()
}
}
function checkFirstRun(done) {
if (RED.settings.theme("tours") === false) {
done();

View File

@@ -27,13 +27,10 @@ RED.actions = (function() {
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) {
const options = def.options;
const key = options?.label || "action-list." + name.replace(/^.*:/, "");
let label = RED._(key, { defaultValue: options?.label || "" });
if (!label) {
// no translation. convert `name` to description
label = name.replace(/(^.+:([a-z]))|(-([a-z]))/g, function() {
if (arguments[5] === 0) {

View File

@@ -34,23 +34,13 @@ RED.clipboard = (function() {
function downloadData(file, data) {
if (window.navigator.msSaveBlob) {
// IE11 workaround
// IE does not support data uri scheme for downloading data
var blob = new Blob([data], {
type: "data:application/json;charset=utf-8"
});
navigator.msSaveBlob(blob, file);
}
else {
var element = document.createElement('a');
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(data));
element.setAttribute('download', file);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
const element = document.createElement('a');
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(data));
element.setAttribute('download', file);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
function setupDialogs() {
@@ -740,7 +730,7 @@ RED.clipboard = (function() {
nodes = RED.view.selection().nodes||[];
}
// Don't include the subflow meta-port nodes in the exported selection
nodes = RED.nodes.createExportableNodeSet(nodes.filter(function(n) { return n.type !== 'subflow'}));
nodes = RED.nodes.createExportableNodeSet(nodes.filter(function(n) { return n.type !== 'subflow'}), { includeModuleConfig: true });
} else if (type === 'flow') {
var activeWorkspace = RED.workspaces.active();
nodes = RED.nodes.groups(activeWorkspace);
@@ -755,9 +745,9 @@ RED.clipboard = (function() {
});
var parentNode = RED.nodes.workspace(activeWorkspace)||RED.nodes.subflow(activeWorkspace);
nodes.unshift(parentNode);
nodes = RED.nodes.createExportableNodeSet(nodes);
nodes = RED.nodes.createExportableNodeSet(nodes, { includeModuleConfig: true });
} else if (type === 'full') {
nodes = RED.nodes.createCompleteNodeSet({ credentials: false });
nodes = RED.nodes.createCompleteNodeSet({ credentials: false, includeModuleConfig: true });
}
if (nodes !== null) {
if (format === "red-ui-clipboard-dialog-export-fmt-full") {
@@ -858,7 +848,7 @@ RED.clipboard = (function() {
children: []
};
treeSubflows.push(subflows[node.id])
} else {
} else if (node.type !== 'global-config') {
nodes.push(node);
}
});

View File

@@ -15,14 +15,25 @@
* The function must either return auto-complete options, or pass them
* to the optional 'done' parameter.
* If the function signature includes 'done', it must be used
* The auto-complete options can either be an array of strings, or an array of objects in the form:
* {
* value: String : the value to insert if selected
* label: String|DOM Element : the label to display in the dropdown.
* }
*
* minLength: number
* If `minLength` is 0, pressing down arrow will show the list
*
* completionPluginType: String
* If provided instead of `search`, this will look for any plugins
* registered with the given type that implement the `getCompletions` function. This
* can be an async function that returns an array of string completions. It does not support
* the full options object as above.
*
* The auto-complete options should be an array of objects in the form:
* {
* value: String : the value to insert if selected
* label: String|DOM Element : the label to display in the dropdown.
* }
* node: Node
* If provided, this will be passed to the `getCompletions` function of the plugin
* to allow the plugin to provide context-aware completions.
*
*
*/
@@ -31,6 +42,54 @@
const that = this;
this.completionMenuShown = false;
this.options.minLength = parseInteger(this.options.minLength, 1, 0);
if (!this.options.search) {
// No search function provided; nothing to provide completions
if (this.options.completionPluginType) {
const plugins = RED.plugins.getPluginsByType(this.options.completionPluginType)
if (plugins.length > 0) {
this.options.search = async function (value, done) {
// for now, only support a single plugin
const promises = plugins.map(plugin => plugin.getCompletions(value, that.options.context))
const completions = (await Promise.all(promises)).flat()
const results = []
completions.forEach(completion => {
const element = $('<div>',{style: "display: flex"})
const valEl = $('<div/>',{ class: "red-ui-autoComplete-completion" })
const valMatch = getMatch(completion, value)
if (valMatch.found) {
valEl.append(generateSpans(valMatch))
valEl.appendTo(element)
results.push({
value: completion,
label: element,
match: valMatch
})
}
results.sort((a, b) => {
if (a.match.exact && !b.match.exact) {
return -1;
} else if (!a.match.exact && b.match.exact) {
return 1;
} else if (a.match.index < b.match.index) {
return -1;
} else if (a.match.index > b.match.index) {
return 1;
} else {
return 0;
}
})
})
done(results)
}
} else {
// No search function and no plugins found
return
}
} else {
// No search function and no plugin type provided
return
}
}
this.options.search = this.options.search || function() { return [] };
this.element.addClass("red-ui-autoComplete");
this.element.on("keydown.red-ui-autoComplete", function(evt) {
@@ -92,6 +151,11 @@
}
return
}
if (typeof completions[0] === "string") {
completions = completions.map(function(c) {
return { value: c, label: c };
});
}
if (that.completionMenuShown) {
that.menu.options(completions);
} else {
@@ -123,4 +187,25 @@
if(isNaN(n) || n < min || n > max) { n = def || 0; }
return n;
}
// TODO: this is copied from typedInput - should be a shared utility
function getMatch(value, searchValue) {
const idx = value.toLowerCase().indexOf(searchValue.toLowerCase());
const len = idx > -1 ? searchValue.length : 0;
return {
index: idx,
found: idx > -1,
pre: value.substring(0,idx),
match: value.substring(idx,idx+len),
post: value.substring(idx+len),
exact: idx === 0 && value.length === searchValue.length
}
}
// TODO: this is copied from typedInput - should be a shared utility
function generateSpans(match) {
const els = [];
if(match.pre) { els.push($('<span/>').text(match.pre)); }
if(match.match) { els.push($('<span/>',{style:"font-weight: bold; color: var(--red-ui-text-color-link);"}).text(match.match)); }
if(match.post) { els.push($('<span/>').text(match.post)); }
return els;
}
})(jQuery);

View File

@@ -163,13 +163,18 @@ RED.popover = (function() {
}
var timer = null;
let isOpen = false
var active;
var div;
var contentDiv;
var currentStyle;
var openPopup = function(instant) {
if (isOpen) {
return
}
if (active) {
isOpen = true
var existingPopover = target.data("red-ui-popover");
if (options.tooltip && existingPopover) {
active = false;
@@ -334,6 +339,7 @@ RED.popover = (function() {
}
var closePopup = function(instant) {
isOpen = false
$(document).off('mousedown.red-ui-popover');
if (!active) {
if (div) {
@@ -673,6 +679,74 @@ RED.popover = (function() {
show:show,
hide:hide
}
},
dialog: function(options) {
const dialogContent = $('<div style="position:relative"></div>');
if (options.closeButton !== false) {
$('<button type="button" class="red-ui-button red-ui-button-small" style="float: right; margin-top: -4px; margin-right: -4px;"><i class="fa fa-times"></i></button>').appendTo(dialogContent).click(function(evt) {
evt.preventDefault();
close();
})
}
const dialogBody = $('<div class="red-ui-dialog-body"></div>').appendTo(dialogContent);
if (options.title) {
$('<h2>').text(options.title).appendTo(dialogBody);
}
$('<div>').css("text-align","left").html(options.content).appendTo(dialogBody);
const stepToolbar = $('<div>',{class:"red-ui-dialog-toolbar"}).appendTo(dialogContent);
if (options.buttons) {
options.buttons.forEach(button => {
const btn = $('<button type="button" class="red-ui-button"></button>').text(button.text).appendTo(stepToolbar);
if (button.class) {
btn.addClass(button.class);
}
if (button.click) {
btn.on('click', function(evt) {
evt.preventDefault();
button.click();
})
}
})
}
const width = 500;
const maxWidth = Math.min($(window).width()-10,Math.max(width || 0, 300));
let shade = $('<div class="red-ui-shade" style="z-index: 2000"></div>').appendTo(document.body);
shade.fadeIn()
let popover = RED.popover.create({
target: $(".red-ui-editor"),
width: width || "auto",
maxWidth: maxWidth+"px",
direction: "inset",
class: "red-ui-dialog",
trigger: "manual",
content: dialogContent
}).open()
function close() {
if (shade) {
shade.fadeOut(() => {
shade.remove()
shade = null
})
}
if (popover) {
popover.close()
popover = null
}
}
return {
close
}
}
}

View File

@@ -165,7 +165,7 @@
valEl.appendTo(element)
if (optSrc) {
const optEl = $('<div>').css({ "font-size": "0.8em" });
const optEl = $('<div/>', { class: "red-ui-autoComplete-env-label" });
let label
if (optSrc.type === 'global-config') {
label = RED._('sidebar.context.global')
@@ -179,7 +179,7 @@
optEl.appendTo(element);
}
matches.push({
value: isSubkey ? val + v + '}' : v,
value: isSubkey ? val.substring(0, i + 2) + v + '}' : v,
label: element,
i: valMatch.index
});
@@ -519,10 +519,25 @@
}
},
expand: function () {
var that = this;
const that = this;
let filter;
if (that.options.node) {
let nodeFilter = that.options.node.filter;
if ((typeof nodeFilter === "string" || typeof nodeFilter === "object") && nodeFilter) {
if (!Array.isArray(nodeFilter)) {
nodeFilter = [nodeFilter];
}
filter = function (node) {
return nodeFilter.includes(node.type);
};
} else if (typeof nodeFilter === "function") {
filter = nodeFilter;
}
}
RED.tray.hide();
RED.view.selectNodes({
single: true,
filter: filter,
selected: [that.value()],
onselect: function (selection) {
that.value(selection.id);

View File

@@ -223,6 +223,11 @@ RED.contextMenu = (function () {
{ onselect: 'core:show-export-dialog', label: RED._("menu.label.export") }
)
}
if (hasSelection && canEdit) {
menuItems.push(
{ onselect: 'core:convert-to-subflow', label: RED._("menu.label.selectionToSubflow") }
)
}
menuItems.push(
{ onselect: 'core:select-all-nodes', label: RED._("keyboard.selectAll") }
)

View File

@@ -180,7 +180,7 @@ RED.deploy = (function() {
}
function updateLockedState() {
if (RED.settings.user?.permissions === 'read') {
if (!RED.user.hasPermission('flows.write')) {
$(".red-ui-deploy-button-group").addClass("readOnly");
$("#red-ui-header-button-deploy").addClass("disabled");
} else {

View File

@@ -1179,7 +1179,7 @@ RED.editor = (function() {
if (editState.outputMap) {
historyEvent.outputMap = editState.outputMap;
}
if (subflowInstances) {
if (subflowInstances && subflowInstances.length) {
historyEvent.subflow = {
instances:subflowInstances
}

View File

@@ -108,7 +108,7 @@ RED.editor.codeEditor.monaco = (function() {
"node-red-util": {package: "node-red", module: "util", path: "node-red/util.d.ts" },
"node-red-func": {package: "node-red", module: "func", path: "node-red/func.d.ts" },
}
const defaultServerSideTypes = [ knownModules["node-red-util"], knownModules["node-red-func"], knownModules["globals"], knownModules["console"], knownModules["buffer"], knownModules["timers"] , knownModules["util"] ];
const defaultServerSideTypes = [ knownModules["node-red-util"], knownModules["node-red-func"], knownModules["globals"], knownModules["console"], knownModules["buffer"], knownModules["timers"], knownModules["url"] , knownModules["util"] ];
const modulesCache = {};
@@ -1426,6 +1426,15 @@ RED.editor.codeEditor.monaco = (function() {
ed.gotoLine(row, col);
}
ed.type = type;
ed.onKeyDown((event) => {
if (event.keyCode === monaco.KeyCode.Escape) {
if (monacoWidgetsAreOpen(ed)) {
event.preventDefault();
}
}
})
return ed;
}
@@ -1435,6 +1444,16 @@ RED.editor.codeEditor.monaco = (function() {
return true;
}
function monacoWidgetsAreOpen(editor) {
/** @type {HTMLElement} */
const editorDomNode = editor.getDomNode()
const suggestVisible = !!editorDomNode.querySelector('.monaco-editor .suggest-widget.visible');
const parameterHintsVisible = !!editorDomNode.querySelector('.monaco-editor .parameter-hints-widget.visible');
const findWidgetVisible = !!editorDomNode.querySelector('.monaco-editor .find-widget.visible');
const renameInputVisible = !!editorDomNode.querySelector('.monaco-editor .rename-box');
return suggestVisible || parameterHintsVisible || findWidgetVisible || renameInputVisible
}
return {
/**
* Editor type

View File

@@ -489,6 +489,9 @@
changes.inputLabels = node.inputLabels;
node.inputLabels = newValue;
changed = true;
if (node.type === "subflow") {
node.in[0].dirty = true
}
}
hasNonBlankLabel = false;
newValue = new Array(node.outputs);

View File

@@ -33,8 +33,7 @@ RED.envVar = (function() {
id: RED.nodes.id(),
type: "global-config",
env: [],
name: "global-config",
label: "",
modules: {},
hasUsers: false,
users: [],
credentials: cred,

View File

@@ -15,11 +15,14 @@
**/
RED.eventLog = (function() {
var template = '<script type="text/x-red" data-template-name="_eventLog"><div class="form-row node-text-editor-row"><div style="height: 100%;min-height: 150px;" class="node-text-editor" id="red-ui-event-log-editor"></div></div></script>';
const template = '<script type="text/x-red" data-template-name="_eventLog"><div class="form-row node-text-editor-row"><div style="height: 100%;min-height: 150px;" class="node-text-editor" id="red-ui-event-log-editor"></div></div></script>';
let eventLogEditor;
let backlog = [];
let shown = false;
const activeLogs = new Set()
var eventLogEditor;
var backlog = [];
var shown = false;
function appendLogLine(line) {
backlog.push(line);
@@ -38,6 +41,19 @@ RED.eventLog = (function() {
init: function() {
$(template).appendTo("#red-ui-editor-node-configs");
RED.actions.add("core:show-event-log",RED.eventLog.show);
const statusWidget = $('<button type="button" class="red-ui-footer-button red-ui-event-log-status" style="line-height: normal"><img style="width: 80%" src="red/images/spin.svg"/></div></button>');
statusWidget.on("click", function(evt) {
RED.actions.invoke("core:show-event-log");
})
RED.statusBar.add({
id: "red-ui-event-log-status",
align: "right",
element: statusWidget
});
RED.popover.tooltip(statusWidget, RED._('actions.open-event-log'));
RED.statusBar.hide("red-ui-event-log-status");
},
show: function() {
if (shown) {
@@ -98,6 +114,12 @@ RED.eventLog = (function() {
},
log: function(id,payload) {
var ts = (new Date(payload.ts)).toISOString()+" ";
if (!payload.end) {
activeLogs.add(id)
} else {
activeLogs.delete(id);
}
if (payload.type) {
ts += "["+payload.type+"] "
}
@@ -111,6 +133,11 @@ RED.eventLog = (function() {
appendLogLine(ts+line);
})
}
if (activeLogs.size > 0) {
RED.statusBar.show("red-ui-event-log-status");
} else {
RED.statusBar.hide("red-ui-event-log-status");
}
},
startEvent: function(name) {
backlog.push("");

View File

@@ -35,6 +35,7 @@ RED.keyboard = (function() {
"backspace": 8,
"delete": 46,
"space": 32,
"tab": 9,
";":186,
"=":187,
"+":187, // <- QWERTY specific
@@ -301,23 +302,27 @@ RED.keyboard = (function() {
return resolveKeyEvent(evt);
}
}
d3.select(window).on("keydown",function() {
d3.select(window).on("keydown", () => {
handleEvent(d3.event)
})
function handleEvent (evt) {
if (!handlersActive) {
return;
}
if (metaKeyCodes[d3.event.keyCode]) {
if (metaKeyCodes[evt]) {
return;
}
var handler = resolveKeyEvent(d3.event);
var handler = resolveKeyEvent(evt);
if (handler && handler.ondown) {
if (typeof handler.ondown === "string") {
RED.actions.invoke(handler.ondown);
} else {
handler.ondown();
}
d3.event.preventDefault();
}
});
evt.preventDefault();
}
}
function addHandler(scope,key,modifiers,ondown) {
var mod = modifiers;
@@ -699,7 +704,8 @@ RED.keyboard = (function() {
formatKey: formatKey,
validateKey: validateKey,
disable: disable,
enable: enable
enable: enable,
handle: handleEvent
}
})();

File diff suppressed because it is too large Load Diff

View File

@@ -80,7 +80,7 @@ RED.palette = (function() {
getNodeCount: function (visibleOnly) {
const nodes = catDiv.find(".red-ui-palette-node")
if (visibleOnly) {
return nodes.filter(function() { return $(this).css('display') !== 'none'}).length
return nodes.filter(function() { return $(this).attr("data-filter") !== "true"}).length
} else {
return nodes.length
}
@@ -572,8 +572,10 @@ RED.palette = (function() {
var currentLabel = $(el).attr("data-palette-label");
var type = $(el).attr("data-palette-type");
if (val === "" || re.test(type) || re.test(currentLabel)) {
$(el).attr("data-filter", null)
$(this).show();
} else {
$(el).attr("data-filter", "true")
$(this).hide();
}
});

View File

@@ -33,6 +33,7 @@ RED.statusBar = (function() {
var el = $('<span class="red-ui-statusbar-widget"></span>');
el.prop('id', options.id);
options.element.appendTo(el);
options.elementDiv = el;
if (options.align === 'left') {
leftBucket.append(el);
} else if (options.align === 'right') {
@@ -40,12 +41,30 @@ RED.statusBar = (function() {
}
}
function hideWidget(id) {
const widget = widgets[id];
if (widget && widget.elementDiv) {
widget.elementDiv.hide();
}
}
function showWidget(id) {
const widget = widgets[id];
if (widget && widget.elementDiv) {
widget.elementDiv.show();
}
}
return {
init: function() {
leftBucket = $('<span class="red-ui-statusbar-bucket red-ui-statusbar-bucket-left">').appendTo("#red-ui-workspace-footer");
rightBucket = $('<span class="red-ui-statusbar-bucket red-ui-statusbar-bucket-right">').appendTo("#red-ui-workspace-footer");
},
add: addWidget
add: addWidget,
hide: hideWidget,
show: showWidget
}
})();

View File

@@ -435,10 +435,15 @@ RED.tourGuide = (function() {
function listTour() {
return [
{
id: "4_1",
label: "4.1",
path: "./tours/welcome.js"
},
{
id: "4_0",
label: "4.0",
path: "./tours/welcome.js"
path: "./tours/4.0/welcome.js"
},
{
id: "3_1",

View File

@@ -230,14 +230,6 @@
editorStack = $("#red-ui-editor-stack");
$(window).on("resize", handleWindowResize);
RED.events.on("sidebar:resize",handleWindowResize);
$("#red-ui-editor-shade").on("click", function() {
if (!openingTray) {
var tray = stack[stack.length-1];
if (tray && tray.primaryButton) {
tray.primaryButton.click();
}
}
});
},
show: function show(options) {
lowerTrayZ();

View File

@@ -14,6 +14,7 @@ RED.typeSearch = (function() {
var addCallback;
var cancelCallback;
var moveCallback;
var suggestCallback
var typesUsed = {};
@@ -25,6 +26,11 @@ RED.typeSearch = (function() {
selected = 0;
searchResults.children().removeClass('selected');
searchResults.children(":visible:first").addClass('selected');
const children = searchResults.children(":visible");
const n = $(children[selected]).find(".red-ui-editableList-item-content").data('data');
if (n) {
updateSuggestion(n)
}
},100);
}
@@ -63,7 +69,7 @@ RED.typeSearch = (function() {
}
});
searchInput.on('keydown',function(evt) {
var children = searchResults.children(":visible");
const children = searchResults.children(":visible");
if (evt.keyCode === 40 && evt.shiftKey) {
evt.preventDefault();
moveDialog(0,10);
@@ -86,9 +92,14 @@ RED.typeSearch = (function() {
selected++;
}
$(children[selected]).addClass('selected');
const n = $(children[selected]).find(".red-ui-editableList-item-content").data('data');
if (n) {
updateSuggestion(n)
}
ensureSelectedIsVisible();
evt.preventDefault();
} else if (evt.keyCode === 38) {
// Up
if (selected > 0) {
if (selected < children.length) {
$(children[selected]).removeClass('selected');
@@ -96,6 +107,10 @@ RED.typeSearch = (function() {
selected--;
}
$(children[selected]).addClass('selected');
const n = $(children[selected]).find(".red-ui-editableList-item-content").data('data');
if (n) {
updateSuggestion(n)
}
ensureSelectedIsVisible();
evt.preventDefault();
} else if ((evt.metaKey || evt.ctrlKey) && evt.keyCode === 13 ) {
@@ -103,14 +118,14 @@ RED.typeSearch = (function() {
// (ctrl or cmd) and enter
var index = Math.max(0,selected);
if (index < children.length) {
var n = $(children[index]).find(".red-ui-editableList-item-content").data('data');
if (!/^_action_:/.test(n.type)) {
const n = $(children[index]).find(".red-ui-editableList-item-content").data('data');
if (!n.nodes && !/^_action_:/.test(n.type)) {
typesUsed[n.type] = Date.now();
}
if (n.def.outputs === 0) {
confirm(n);
} else {
addCallback(n.type,true);
addCallback(n, true);
}
$("#red-ui-type-search-input").val("").trigger("keyup");
setTimeout(function() {
@@ -142,7 +157,7 @@ RED.typeSearch = (function() {
if (activeFilter === "" ) {
return true;
}
if (data.recent || data.common) {
if (data.recent || data.common || data.suggestion) {
return false;
}
return (activeFilter==="")||(data.index.indexOf(activeFilter) > -1);
@@ -164,67 +179,133 @@ RED.typeSearch = (function() {
}
return Ai-Bi;
},
addItem: function(container,i,object) {
var def = object.def;
object.index = object.type.toLowerCase();
if (object.separator) {
addItem: function(container, i, nodeItem) {
// nodeItem can take multiple forms
// - A node type: {type: "inject", def: RED.nodes.getType("inject"), label: "Inject"}
// - A placeholder suggestion: { suggestionPlaceholder: true, label: 'loading suggestions...' }
let nodeDef = nodeItem.def;
let nodeType = nodeItem.type;
if (nodeItem.suggestion && nodeItem.nodes.length > 0) {
nodeDef = RED.nodes.getType(nodeItem.nodes[0].type);
nodeType = nodeItem.nodes[0].type;
}
nodeItem.index = nodeItem.type?.toLowerCase() || '';
if (nodeItem.separator) {
container.addClass("red-ui-search-result-separator")
}
var div = $('<div>',{class:"red-ui-search-result"}).appendTo(container);
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div);
if (object.type === "junction") {
const div = $('<div>',{class:"red-ui-search-result"}).appendTo(container);
const nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div);
if (nodeItem.suggestionPlaceholder) {
nodeDiv.addClass("red-ui-palette-icon-suggestion")
const iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
$('<i class="spinner" style="margin-top: -1px">').appendTo(iconContainer);
} else if (nodeType === "junction") {
nodeDiv.addClass("red-ui-palette-icon-junction");
} else if (/^_action_:/.test(object.type)) {
nodeDiv.addClass("red-ui-palette-icon-junction")
} else {
var colour = RED.utils.getNodeColor(object.type,def);
nodeDiv.css('backgroundColor',colour);
nodeDiv.css('backgroundColor', RED.utils.getNodeColor(nodeType, nodeDef));
}
var icon_url = RED.utils.getNodeIcon(def);
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
RED.utils.createIconElement(icon_url, iconContainer, false);
if (nodeDef) {
// Add the node icon
const icon_url = RED.utils.getNodeIcon(nodeDef);
const iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
RED.utils.createIconElement(icon_url, iconContainer, false);
}
if (/^subflow:/.test(object.type)) {
var sf = RED.nodes.subflow(object.type.substring(8));
if (/^subflow:/.test(nodeType)) {
var sf = RED.nodes.subflow(nodeType.substring(8));
if (sf.in.length > 0) {
$('<div/>',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv);
}
if (sf.out.length > 0) {
$('<div/>',{class:"red-ui-search-result-node-port red-ui-search-result-node-output"}).appendTo(nodeDiv);
}
} else if (!/^_action_:/.test(object.type) && object.type !== "junction") {
if (def.inputs > 0) {
} else if (nodeDef && nodeType !== "junction") {
if (nodeDef.inputs > 0) {
$('<div/>',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv);
}
if (def.outputs > 0) {
if (nodeDef.outputs > 0) {
$('<div/>',{class:"red-ui-search-result-node-port red-ui-search-result-node-output"}).appendTo(nodeDiv);
}
}
var contentDiv = $('<div>',{class:"red-ui-search-result-description"}).appendTo(div);
var label = object.label;
object.index += "|"+label.toLowerCase();
var label = nodeItem.label;
nodeItem.index += "|"+label.toLowerCase();
$('<div>',{class:"red-ui-search-result-node-label"}).text(label).appendTo(contentDiv);
nodeItem.element = container;
div.on("click", function(evt) {
evt.preventDefault();
confirm(object);
confirm(nodeItem);
});
div.on('mouseenter', function() {
const children = searchResults.children(":visible");
if (selected > -1 && selected < children.length) {
$(children[selected]).removeClass('selected');
}
const editableListItem = container.parent()
selected = children.index(editableListItem);
$(children[selected]).addClass('selected');
updateSuggestion(nodeItem);
})
},
scrollOnAdd: false
});
}
let activeSuggestion
function updateSuggestion(nodeItem) {
if (nodeItem === activeSuggestion) {
return
}
if (!visible && nodeItem) {
// Do not update suggestion if the dialog is not visible
// - for example, whilst the dialog is closing and the user mouses over a new item
return
}
activeSuggestion = nodeItem
if (suggestCallback) {
if (!nodeItem) {
suggestCallback(null);
} else if (nodeItem.nodes) {
// This is a multi-node suggestion
suggestCallback({
nodes: nodeItem.nodes
});
} else if (nodeItem.type) {
// Single node suggestion
suggestCallback({
nodes: [{
x: 0,
y: 0,
type: nodeItem.type
}]
});
}
}
}
function confirm(def) {
if (!activeSuggestion) {
// The user has hit Enter without selecting an entry in the list.
// This means no suggestion has been shown yet - and the position recalculation
// has not been done.
// Trigger an update of the suggestion to get the position right before
// applying.
updateSuggestion(def)
}
hide();
if (!/^_action_:/.test(def.type)) {
if (!def.nodes && !/^_action_:/.test(def.type)) {
typesUsed[def.type] = Date.now();
}
addCallback(def.type);
addCallback(def);
}
function handleMouseActivity(evt) {
@@ -255,6 +336,7 @@ RED.typeSearch = (function() {
}
visible = true;
} else {
updateSuggestion(null)
dialog.hide();
searchResultsDiv.hide();
}
@@ -274,6 +356,7 @@ RED.typeSearch = (function() {
addCallback = opts.add;
cancelCallback = opts.cancel;
moveCallback = opts.move;
suggestCallback = opts.suggest;
RED.events.emit("type-search:open");
//shade.show();
if ($("#red-ui-main-container").height() - opts.y - 195 < 0) {
@@ -294,6 +377,7 @@ RED.typeSearch = (function() {
},200);
}
function hide(fast) {
updateSuggestion(null)
if (visible) {
visible = false;
if (dialog !== null) {
@@ -356,11 +440,11 @@ RED.typeSearch = (function() {
(!filter.output || def.outputs > 0)
}
function refreshTypeList(opts) {
var i;
let i;
searchResults.editableList('empty');
searchInput.searchBox('value','').focus();
selected = -1;
var common = [
const common = [
'inject','debug','function','change','switch','junction'
].filter(function(t) { return applyFilter(opts.filter,t,RED.nodes.getType(t)); });
@@ -371,7 +455,7 @@ RED.typeSearch = (function() {
// common.push('_action_:core:split-wire-with-link-nodes')
// }
var recentlyUsed = Object.keys(typesUsed);
let recentlyUsed = Object.keys(typesUsed);
recentlyUsed.sort(function(a,b) {
return typesUsed[b]-typesUsed[a];
});
@@ -379,9 +463,10 @@ RED.typeSearch = (function() {
return applyFilter(opts.filter,t,RED.nodes.getType(t)) && common.indexOf(t) === -1;
});
var items = [];
const items = [];
RED.nodes.registry.getNodeTypes().forEach(function(t) {
var def = RED.nodes.getType(t);
const def = RED.nodes.getType(t);
if (def.set?.enabled !== false && def.category !== 'config' && t !== 'unknown' && t !== 'tab') {
items.push({type:t,def: def, label:getTypeLabel(t,def)});
}
@@ -389,18 +474,51 @@ RED.typeSearch = (function() {
items.push({ type: 'junction', def: { inputs:1, outputs: 1, label: 'junction', type: 'junction'}, label: 'junction' })
items.sort(sortTypeLabels);
var commonCount = 0;
var item;
var index = 0;
let index = 0;
if (!opts.context?.virtualLink) {
// Check for suggestion plugins
const suggestionPlugins = RED.plugins.getPluginsByType('node-red-flow-suggestion-source');
if (suggestionPlugins.length > 0) {
const suggestionItem = {
suggestionPlaceholder: true,
label: RED._('palette.loadingSuggestions'),
separator: true,
i: index++
}
searchResults.editableList('addItem', suggestionItem);
suggestionPlugins[0].getSuggestions(opts.context).then(function (suggestedFlows) {
searchResults.editableList('removeItem', suggestionItem);
if (!Array.isArray(suggestedFlows)) {
suggestedFlows = [suggestedFlows];
}
suggestedFlows.forEach(function(suggestion, index) {
const suggestedItem = {
suggestion: true,
separator: index === suggestedFlows.length - 1,
i: suggestionItem.i,
...suggestion
}
if (!suggestion.label && suggestion.nodes && suggestion.nodes.length === 1 && suggestion.nodes[0].type) {
suggestedItem.label = getTypeLabel(suggestion.nodes[0].type, RED.nodes.getType(suggestion.nodes[0].type));
}
searchResults.editableList('addItem', suggestedItem);
})
})
}
}
for(i=0;i<common.length;i++) {
var itemDef = RED.nodes.getType(common[i]);
let itemDef
if (common[i] === 'junction') {
itemDef = { inputs:1, outputs: 1, label: 'junction', type: 'junction'}
} else if (/^_action_:/.test(common[i]) ) {
itemDef = { inputs:1, outputs: 1, label: common[i], type: common[i]}
} else {
itemDef = RED.nodes.getType(common[i]);
}
if (itemDef) {
item = {
const item = {
type: common[i],
common: true,
def: itemDef,
@@ -414,7 +532,7 @@ RED.typeSearch = (function() {
}
}
for(i=0;i<Math.min(5,recentlyUsed.length);i++) {
item = {
const item = {
type:recentlyUsed[i],
def: RED.nodes.getType(recentlyUsed[i]),
recent: true,
@@ -439,9 +557,10 @@ RED.typeSearch = (function() {
}
return {
show: show,
show,
refresh: refreshTypeList,
hide: hide
hide,
isVisible: () => visible
};
})();

View File

@@ -140,9 +140,22 @@ RED.userSettings = (function() {
title: "menu.label.nodes",
options: [
{setting:"view-node-status",oldSetting:"menu-menu-item-status",label:"menu.label.displayStatus",default: true, toggle:true,onchange:"core:toggle-status"},
{setting:"view-node-info-icon", label:"menu.label.displayInfoIcon", default: true, toggle:true,onchange:"core:toggle-node-info-icon"},
{setting:"view-node-show-label",label:"menu.label.showNodeLabelDefault",default: true, toggle:true}
]
},
{
title: "telemetry.label",
options: [
{
global: true,
setting: "telemetryEnabled",
label: "telemetry.settingsTitle",
description: "telemetry.settingsDescription",
toggle: true
},
]
},
{
title: "menu.label.other",
options: [
@@ -169,13 +182,20 @@ RED.userSettings = (function() {
var initialState;
if (opt.local) {
initialState = localStorage.getItem(opt.setting);
} else if (opt.global) {
initialState = RED.settings.get(opt.setting);
} else {
initialState = currentEditorSettings.view[opt.setting];
}
var row = $('<div class="red-ui-settings-row"></div>').appendTo(pane);
var input;
if (opt.toggle) {
input = $('<label for="user-settings-'+opt.setting+'"><input id="user-settings-'+opt.setting+'" type="checkbox"> '+RED._(opt.label)+'</label>').appendTo(row).find("input");
let label = RED._(opt.label)
if (opt.description) {
label = `<p>${label}</p>${RED._(opt.description)}`;
}
input = $('<input id="user-settings-'+opt.setting+'" type="checkbox">').appendTo(row)
$('<label for="user-settings-'+opt.setting+'">'+label+'</label>').appendTo(row)
input.prop('checked',initialState);
} else if (opt.options) {
$('<label for="user-settings-'+opt.setting+'">'+RED._(opt.label)+'</label>').appendTo(row);
@@ -209,6 +229,8 @@ RED.userSettings = (function() {
var opt = allSettings[id];
if (opt.local) {
localStorage.setItem(opt.setting,value);
} else if (opt.global) {
RED.settings.set(opt.setting, value)
} else {
var currentEditorSettings = RED.settings.get('editor') || {};
currentEditorSettings.view = currentEditorSettings.view || {};
@@ -237,7 +259,7 @@ RED.userSettings = (function() {
addPane({
id:'view',
title: RED._("menu.label.view.view"),
title: RED._("menu.label.settings"),
get: createViewPane,
close: function() {
viewSettings.forEach(function(section) {

View File

@@ -15,6 +15,7 @@
**/
RED.utils = (function() {
const listOfTypedArrays = ['Int8Array','Uint8Array','Uint8ClampedArray','Int16Array','Uint16Array','Int32Array','Uint32Array','Float32Array','Float64Array','BigInt64Array','BigUint64Array'];
window._marked = window.marked;
window.marked = function(txt) {
@@ -128,10 +129,25 @@ RED.utils = (function() {
function formatString(str) {
return str.replace(/\r?\n/g,"&crarr;").replace(/\t/g,"&rarr;");
}
function sanitize(m) {
return m.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
}
/**
* Truncates a string to a specified maximum length, adding ellipsis
* if truncated.
*
* @param {string} str The string to be truncated.
* @param {number} [maxLength = 120] The maximum length of the truncated
* string. Default `120`.
* @returns {string} The truncated string with ellipsis if it exceeds the
* maximum length.
*/
function truncateString(str, maxLength = 120) {
return str.length > maxLength ? str.slice(0, maxLength) + "..." : str;
}
function buildMessageSummaryValue(value) {
var result;
if (Array.isArray(value)) {
@@ -155,6 +171,8 @@ RED.utils = (function() {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-number"></span>').text(value.data);
} else if (value.hasOwnProperty('type') && value.type === 'regexp') {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-string"></span>').text(value.data);
} else if (value.hasOwnProperty('type') && value.hasOwnProperty('data') && listOfTypedArrays.includes(value.type)) {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta"></span>').text(value.type + '['+value.length+']');
} else {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta">object</span>');
}
@@ -379,6 +397,9 @@ RED.utils = (function() {
}
}
// Max string length before truncating
const MAX_STRING_LENGTH = 80;
/**
* Create a DOM element representation of obj - as used by Debug sidebar etc
*
@@ -457,7 +478,7 @@ RED.utils = (function() {
var isArray = Array.isArray(obj);
var isArrayObject = false;
if (obj && typeof obj === 'object' && obj.hasOwnProperty('type') && obj.hasOwnProperty('data') && ((obj.__enc__ && obj.type === 'set') || (obj.__enc__ && obj.type === 'array') || obj.type === 'Buffer')) {
if (obj && typeof obj === 'object' && obj.hasOwnProperty('type') && obj.hasOwnProperty('data') && ((obj.__enc__ && obj.type === 'set') || (obj.__enc__ && obj.type === 'array') || (obj.__enc__ && listOfTypedArrays.includes(obj.type)) || obj.type === 'Buffer')) {
isArray = true;
isArrayObject = true;
}
@@ -474,7 +495,7 @@ RED.utils = (function() {
} else if (typeHint === "internal" || (obj.__enc__ && obj.type === 'internal')) {
e = $('<span class="red-ui-debug-msg-type-meta red-ui-debug-msg-object-header"></span>').text("[internal]").appendTo(entryObj);
} else if (typeof obj === 'string') {
if (/[\t\n\r]/.test(obj)) {
if (/[\t\n\r]/.test(obj) || obj.length > MAX_STRING_LENGTH) {
element.addClass('collapsed');
$('<i class="fa fa-caret-right red-ui-debug-msg-object-handle"></i> ').prependTo(header);
makeExpandable(header, function() {
@@ -483,7 +504,7 @@ RED.utils = (function() {
$('<pre class="red-ui-debug-msg-type-string"></pre>').text(obj).appendTo(row);
},function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey, expandPaths, { expandLeafNodes }));
}
e = $('<span class="red-ui-debug-msg-type-string red-ui-debug-msg-object-header"></span>').html('"'+formatString(sanitize(obj))+'"').appendTo(entryObj);
e = $('<span class="red-ui-debug-msg-type-string red-ui-debug-msg-object-header"></span>').html('"'+formatString(sanitize(truncateString(obj, MAX_STRING_LENGTH)))+'"').appendTo(entryObj);
if (/^#[0-9a-f]{6}$/i.test(obj)) {
$('<span class="red-ui-debug-msg-type-string-swatch"></span>').css('backgroundColor',obj).appendTo(e);
}
@@ -1281,7 +1302,7 @@ RED.utils = (function() {
payload = Infinity;
} else if ((format === 'number') && (payload === "-Infinity")) {
payload = -Infinity;
} else if (format === 'Object' || /^(array|set|map)/.test(format) || format === 'boolean' || format === 'number' ) {
} else if (format === 'Object' || /^(array|set|map)/.test(format) || format === 'boolean' || format === 'number' || listOfTypedArrays.includes(format)) {
payload = JSON.parse(payload);
} else if (/error/i.test(format)) {
payload = JSON.parse(payload);
@@ -1513,6 +1534,7 @@ RED.utils = (function() {
parseContextKey: parseContextKey,
createIconElement: createIconElement,
sanitize: sanitize,
truncateString: truncateString,
renderMarkdown: renderMarkdown,
createNodeIcon: createNodeIcon,
getDarkerColor: getDarkerColor,

View File

@@ -24,7 +24,7 @@ RED.view.annotations = (function() {
refreshAnnotation = !!evt.node[opts.refresh]
delete evt.node[opts.refresh]
} else if (typeof opts.refresh === "function") {
refreshAnnotation = opts.refresh(evnt.node)
refreshAnnotation = opts.refresh(evt.node)
}
if (refreshAnnotation) {
refreshAnnotationElement(annotation.id, annotation.node, annotation.element)

View File

@@ -1149,8 +1149,8 @@ RED.view.tools = (function() {
t: 'multi',
events: historyEvents
})
RED.nodes.dirty(true)
}
RED.nodes.dirty(true)
RED.view.redraw()
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,5 @@
@use "mixins";
.red-ui-editor, .red-ui-editor-dialog {
.ace_read-only {
@@ -42,7 +44,7 @@
background: var(--red-ui-popover-background);
color: var(--red-ui-popover-color);
border-radius: 4px;
@include component-shadow;
@include mixins.component-shadow;
border-color: var(--red-ui-popover-background);
}
.ace_content {

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -43,7 +45,7 @@ body {
}
#red-ui-palette-shade, #red-ui-editor-shade, #red-ui-header-shade, #red-ui-sidebar-shade {
@include shade;
@include mixins.shade;
z-index: 5;
}
#red-ui-sidebar-shade {
@@ -52,7 +54,7 @@ body {
bottom: -1px;
}
#red-ui-full-shade {
@include shade;
@include mixins.shade;
z-index: 15;
}
.red-ui-editor,

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -63,7 +65,7 @@
}
}
.red-ui-tray-header {
@include disable-selection;
@include mixins.disable-selection;
position: relative;
box-sizing: border-box;
font-weight: bold;
@@ -77,7 +79,7 @@
}
.red-ui-tray-footer {
@include component-footer;
@include mixins.component-footer;
height: 35px;
font-size: 14px !important;
line-height: 35px;
@@ -110,9 +112,9 @@
padding: 6px;
button {
@include editor-button;
@include mixins.editor-button;
&.toggle {
@include workspace-button-toggle;
@include mixins.workspace-button-toggle;
}
}
}
@@ -179,7 +181,7 @@
}
a.red-ui-tray-resize-button,
button.red-ui-tray-resize-button {
@include workspace-button;
@include mixins.workspace-button;
display: block;
height: 37px;
line-height: 35px;
@@ -274,7 +276,7 @@ button.editor-button, // Deprecated: use .red-ui-button
a.red-ui-button,
button.red-ui-button
{
@include workspace-button;
@include mixins.workspace-button;
height: 34px;
line-height: 32px;
font-size: 13px;
@@ -283,7 +285,7 @@ button.red-ui-button
white-space: nowrap;
text-overflow: ellipsis;
&.toggle {
@include workspace-button-toggle;
@include mixins.workspace-button-toggle;
}
}

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -41,7 +43,7 @@
font-size: 14px;
pointer-events: none;
-webkit-touch-callout: none;
@include disable-selection;
@include mixins.disable-selection;
.red-ui-flow-node-label-text {
dominant-baseline: middle;
@@ -60,7 +62,7 @@
text-anchor: middle;
pointer-events: none;
-webkit-touch-callout: none;
@include disable-selection;
@include mixins.disable-selection;
}
@@ -155,11 +157,19 @@ svg:not(.red-ui-workspace-lasso-active) {
stroke-opacity: var(--red-ui-group-default-stroke-opacity);
}
.red-ui-flow-group-label {
@include disable-selection;
@include mixins.disable-selection;
fill: var(--red-ui-group-default-label-color);
}
.red-ui-flow-node-ghost {
opacity: 0.6;
rect.red-ui-flow-node {
stroke: var(--red-ui-node-border-placeholder);
stroke-dasharray:10,4;
stroke-width: 2;
}
}
.red-ui-flow-node-unknown {
stroke-dasharray:10,4;
@@ -174,10 +184,10 @@ svg:not(.red-ui-workspace-lasso-active) {
}
.red-ui-flow-node-icon-group {
text {
@include disable-selection;
@include mixins.disable-selection;
}
.fa-lg {
@include disable-selection;
@include mixins.disable-selection;
stroke: none;
fill: var(--red-ui-node-icon-color);
text-anchor: middle;
@@ -242,6 +252,18 @@ svg:not(.red-ui-workspace-lasso-active) {
stroke-linecap: round;
}
.red-ui-flow-node-docs {
stroke-width: 1px;
stroke-linejoin: round;
stroke-linecap: round;
stroke: var(--red-ui-node-border);
fill: none;
cursor: pointer;
rect {
fill: white;
}
}
g.red-ui-flow-node-selected {
.red-ui-workspace-select-mode & {
opacity: 1;
@@ -311,7 +333,7 @@ g.red-ui-flow-node-selected {
fill-opacity: 0.9;
}
.red-ui-flow-node-status-label {
@include disable-selection;
@include mixins.disable-selection;
stroke-width: 0;
fill: var(--red-ui-secondary-text-color);
font-size:9pt;
@@ -387,6 +409,13 @@ g.red-ui-flow-node-selected {
g.red-ui-flow-link-selected path.red-ui-flow-link-line {
stroke: var(--red-ui-node-selected-color);
}
g.red-ui-flow-link-ghost path.red-ui-flow-link-line {
stroke: var(--red-ui-node-border-placeholder);
stroke-width: 2;
stroke-dasharray: 10, 4;
}
g.red-ui-flow-link-unknown path.red-ui-flow-link-line {
stroke: var(--red-ui-link-unknown-color);
stroke-width: 2;
@@ -417,7 +446,7 @@ g.red-ui-flow-link-unknown path.red-ui-flow-link-line {
pointer-events: none;
-webkit-touch-callout: none;
white-space: pre;
@include disable-selection;
@include mixins.disable-selection;
}
.red-ui-flow-junction-dragging {
.red-ui-flow-junction-background {

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -15,7 +17,7 @@
**/
.button {
@include disable-selection;
@include mixins.disable-selection;
}
#red-ui-header {
@@ -50,7 +52,7 @@
}
}
img {
height: 18px;
height: 32px;
}
a {

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -54,7 +56,7 @@
border-radius: 1px;
background: var(--red-ui-secondary-background);
padding: 0;
@include component-shadow;
@include mixins.component-shadow;
}
.ui-dialog .ui-dialog-content {
padding: 25px 25px 10px 25px;
@@ -92,7 +94,7 @@
}
.ui-dialog-buttonset button {
@include workspace-button;
@include mixins.workspace-button;
font-size: 14px;
padding: 6px 14px;
margin-right: 8px;
@@ -160,7 +162,7 @@
.ui-widget-overlay {
@include shade;
@include mixins.shade;
z-index: 100;
opacity: 1;
}

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -254,7 +256,7 @@
display: flex;
flex-direction: row;
span:not(:nth-child(2)) {
@include disable-selection;
@include mixins.disable-selection;
}
span {
padding: 8px 0;

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -117,19 +119,27 @@
.red-ui-palette-module-updated {
margin-left: 10px;
}
.red-ui-palette-module-downloads {
margin-left: 10px;
}
.red-ui-palette-module-link {
margin-left: 5px;
}
.red-ui-palette-module-deprecated {
cursor: pointer;
color: var(--red-ui-text-color-error);
font-size: 0.7em;
border: 1px solid var(--red-ui-text-color-error);
border-radius: 30px;
padding: 2px 5px;
}
.red-ui-palette-module-description {
margin-left: 20px;
font-size: 0.9em;
color: var(--red-ui-secondary-text-color);
}
.red-ui-palette-module-link {
}
.red-ui-palette-module-set-button-group {
}
.red-ui-palette-module-content {
display: none;
padding: 10px 3px;
@@ -167,7 +177,7 @@
color: var(--red-ui-secondary-text-color);
padding-left: 5px;
font-size: 0.9em;
@include enable-selection;
@include mixins.enable-selection;
}
.red-ui-palette-module-type-swatch {
display: inline-block;
@@ -226,12 +236,12 @@
.red-ui-palette-module-name {
color: var(--red-ui-primary-text-color);
white-space: nowrap;
@include enable-selection;
@include mixins.enable-selection;
}
.red-ui-palette-module-version, .red-ui-palette-module-updated, .red-ui-palette-module-link {
.red-ui-palette-module-version, .red-ui-palette-module-updated, .red-ui-palette-module-link, .red-ui-palette-module-downloads {
font-style:italic;
font-size: 0.8em;
@include enable-selection;
@include mixins.enable-selection;
}
.red-ui-palette-module-button-group {
position: absolute;
@@ -256,7 +266,7 @@ ul.red-ui-palette-module-error-list {
}
.red-ui-palette-module-shade {
@include shade;
@include mixins.shade;
text-align: center;
padding-top: 20px;
}
@@ -305,3 +315,8 @@ button.red-ui-palette-editor-upload-button {
margin-left: 10px;
}
}
button.red-ui-update-status {
width: auto;
padding: 0 3px;
}

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -23,9 +25,29 @@
background: var(--red-ui-primary-background);
width: 180px;
text-align: center;
@include disable-selection;
@include component-border;
@include mixins.disable-selection;
@include mixins.component-border;
transition: width 0.2s ease-in-out;
&:before {
content: '';
top: 0px;
bottom: 0px;
right: 0px;
width: 7px;
height: 100%;
z-index: 4;
position: absolute;
-webkit-mask-image: url(images/grip.svg);
mask-image: url(images/grip.svg);
-webkit-mask-size: auto;
mask-size: auto;
-webkit-mask-position: 50% 50%;
mask-position: 50% 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: var(--red-ui-grip-color);
}
}
.red-ui-palette-closed {
@@ -112,7 +134,7 @@
line-height: 20px;
overflow: hidden;
text-align: center;
@include disable-selection;
@include mixins.disable-selection;
}
.red-ui-palette-label-right {
margin: 4px 32px 4px 0;

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -28,7 +30,7 @@
font-family: var(--red-ui-primary-font);
font-size: 14px;
line-height: 1.4em;
@include component-shadow;
@include mixins.component-shadow;
border-color: var(--red-ui-popover-border);
}
.red-ui-popover-content {
@@ -194,7 +196,7 @@
.red-ui-popover-panel {
@include component-shadow;
@include mixins.component-shadow;
font-family: var(--red-ui-primary-font);
font-size: var(--red-ui-primary-font-size);
position: absolute;
@@ -203,3 +205,39 @@
background: var(--red-ui-secondary-background);
z-index: 2000;
}
.red-ui-popover.red-ui-dialog {
z-index: 2003;
--red-ui-popover-background: var(--red-ui-secondary-background);
--red-ui-popover-border: var(--red-ui-tourGuide-border);
--red-ui-popover-color: var(--red-ui-primary-text-color);
.red-ui-popover-content {
h2 {
text-align: center;
margin-top: 0px;
line-height: 1.2em;
color: var(--red-ui-tourGuide-heading-color);
i.fa {
font-size: 1.5em
}
}
}
}
.red-ui-dialog-toolbar {
min-height: 36px;
position: relative;
display: flex;
justify-content: flex-end;
gap: 10px;
}
.red-ui-dialog-body {
padding: 20px 40px 10px;
a {
color: var(--red-ui-text-color-link) !important;
text-decoration: none;
}
}

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -23,7 +25,7 @@
background: var(--red-ui-primary-background);
box-sizing: border-box;
z-index: 10;
@include component-border;
@include mixins.component-border;
}
#red-ui-sidebar.closing {
@@ -73,7 +75,7 @@
.red-ui-sidebar-closed > #red-ui-editor-stack { right: 8px !important; }
#red-ui-sidebar .button {
@include workspace-button;
@include mixins.workspace-button;
line-height: 18px;
font-size: 12px;
margin-right: 5px;
@@ -92,23 +94,23 @@
/* Deprecated -> red-ui-footer-button */
.sidebar-footer-button {
@include component-footer-button;
@include mixins.component-footer-button;
}
/* Deprecated -> red-ui-footer-button-toggle */
.sidebar-footer-button-toggle {
@include component-footer-button-toggle;
@include mixins.component-footer-button-toggle;
}
a.sidebar-header-button,
button.sidebar-header-button, /* Deprecated -> red-ui-sidebar-header-button */
a.red-ui-sidebar-header-button,
button.red-ui-sidebar-header-button {
@include workspace-button;
@include mixins.workspace-button;
font-size: 13px;
line-height: 13px;
padding: 5px 8px;
&.toggle {
@include workspace-button-toggle;
@include mixins.workspace-button-toggle;
}
}
@@ -116,7 +118,7 @@ a.sidebar-header-button-toggle, /* Deprecated -> red-ui-sidebar-header-button-to
button.sidebar-header-button-toggle, /* Deprecated -> red-ui-sidebar-header-button-toggle */
a.red-ui-sidebar-header-button-toggle,
button.red-ui-sidebar-header-button-toggle {
@include workspace-button-toggle;
@include mixins.workspace-button-toggle;
font-size: 13px;
line-height: 13px;
padding: 5px 8px;
@@ -128,7 +130,7 @@ button.red-ui-sidebar-header-button-toggle {
}
.red-ui-sidebar-shade {
@include shade;
@include mixins.shade;
}

View File

@@ -14,6 +14,6 @@
* limitations under the License.
**/
@import "colors";
@import "sizes";
@import "variables";
@use "colors";
@use "sizes";
@use "variables";

View File

@@ -14,64 +14,64 @@
* limitations under the License.
**/
@import "colors";
@import "sizes";
@import "variables";
@import "mixins";
@use "colors";
@use "sizes";
@use "variables";
@use "mixins";
@import "base";
@import "forms";
@use "base";
@use "forms";
@import "jquery";
@import "ace";
@use "jquery";
@use "ace";
@import "dropdownMenu";
@use "dropdownMenu";
@import "header";
@import "palette";
@import "sidebar";
@import "workspace";
@import "workspaceToolbar";
@use "header";
@use "palette";
@use "sidebar";
@use "workspace";
@use "workspaceToolbar";
@import "notifications";
@use "notifications";
@import "editor";
@import "library";
@import "search";
@use "editor";
@use "library";
@use "search";
@import "panels";
@import "tabs";
@import "tab-config";
@import "tab-context";
@import "tab-info";
@import "tab-help";
@import "popover";
@import "flow";
@import "palette-editor";
@import "diff";
@use "panels";
@use "tabs";
@use "tab-config";
@use "tab-context";
@use "tab-info";
@use "tab-help";
@use "popover";
@use "flow";
@use "palette-editor";
@use "diff";
@import "userSettings";
@use "userSettings";
@import "projects";
@use "projects";
@import "ui/common/editableList";
@import "ui/common/searchBox";
@import "ui/common/typedInput";
@import "ui/common/nodeList";
@import "ui/common/checkboxSet";
@import "ui/common/stack";
@import "ui/common/treeList";
@import "ui/common/autoComplete";
@use "ui/common/editableList";
@use "ui/common/searchBox";
@use "ui/common/typedInput";
@use "ui/common/nodeList";
@use "ui/common/checkboxSet";
@use "ui/common/stack";
@use "ui/common/treeList";
@use "ui/common/autoComplete";
@import "dragdrop";
@use "dragdrop";
@import "keyboard";
@use "keyboard";
@import "debug";
@use "debug";
@import "radialMenu";
@use "radialMenu";
@import "tourGuide";
@use "tourGuide";
@import "multiplayer";
@use "multiplayer";

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -38,7 +40,7 @@
background: var(--red-ui-secondary-background);
height: 100%;
overflow-y:auto;
@include disable-selection;
@include mixins.disable-selection;
&:focus {
outline: none;

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -25,6 +27,7 @@
padding-left: 9px;
line-height: 21px;
cursor: default;
border-bottom: 1px solid var(--red-ui-secondary-border-color);
> * {
vertical-align: middle
}
@@ -33,7 +36,6 @@
margin-left: 5px;
overflow-wrap: anywhere;
}
border-bottom: 1px solid var(--red-ui-secondary-border-color);
}
table.red-ui-info-table {
font-size: 14px;
@@ -307,7 +309,7 @@ div.red-ui-info-table {
text-align: center;
line-height: 1.9em;
color : var(--red-ui-tertiary-text-color);
@include disable-selection;
@include mixins.disable-selection;
cursor: default;
}
.red-ui-help-tips-buttons {

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -41,7 +43,7 @@
box-sizing:border-box;
border-bottom: 1px solid var(--red-ui-primary-border-color);
white-space: nowrap;
@include disable-selection;
@include mixins.disable-selection;
li {
box-sizing: border-box;
@@ -244,7 +246,7 @@
z-index: 2;
a {
@include workspace-button;
@include mixins.workspace-button;
line-height: 30px;
height: 28px;
width: 28px;
@@ -266,7 +268,7 @@
border-bottom: 1px solid var(--red-ui-primary-border-color);
z-index: 2;
a {
@include workspace-button-toggle;
@include mixins.workspace-button-toggle;
line-height: 26px;
height: 28px;
width: 28px;

View File

@@ -13,4 +13,12 @@
text-overflow: ellipsis;
direction: rtl;
text-align: left;
padding-right: 16px;
}
.red-ui-autoComplete-env-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 0.8em;
max-width: 70%;
}

View File

@@ -1,3 +1,5 @@
@use "../../mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -67,7 +69,7 @@
}
}
.red-ui-treeList-label {
@include disable-selection;
@include mixins.disable-selection;
padding: 6px 0;
display: flex;
align-items: center;

View File

@@ -1,3 +1,5 @@
@use "../../mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -67,7 +69,7 @@
}
}
.red-ui-typedInput-options {
@include component-shadow;
@include mixins.component-shadow;
font-family: var(--red-ui-primary-font);
font-size: var(--red-ui-primary-font-size);

View File

@@ -70,8 +70,14 @@
overflow-y: auto;
}
.red-ui-settings-row {
display: flex;
gap: 10px;
align-items:flex-start;
padding: 5px 10px 2px;
}
.red-ui-settings-row input[type="checkbox"] {
margin-top: 8px;
}
.red-ui-settings-section {
position: relative;
&:after {

View File

@@ -1,305 +1,309 @@
@use "sass:map";
@use "colors";
@use "sizes";
:root {
--red-ui-primary-font: #{$primary-font};
--red-ui-primary-font-size: #{$primary-font-size};
--red-ui-monospace-font: #{$monospace-font};
--red-ui-primary-font: #{colors.$primary-font};
--red-ui-primary-font-size: #{colors.$primary-font-size};
--red-ui-monospace-font: #{colors.$monospace-font};
--red-ui-primary-background: #{$primary-background};
--red-ui-primary-background: #{colors.$primary-background};
--red-ui-secondary-background: #{$secondary-background};
--red-ui-secondary-background-selected: #{$secondary-background-selected};
--red-ui-secondary-background-inactive: #{$secondary-background-inactive};
--red-ui-secondary-background-hover: #{$secondary-background-hover};
--red-ui-secondary-background-disabled: #{$secondary-background-disabled};
--red-ui-secondary-background: #{colors.$secondary-background};
--red-ui-secondary-background-selected: #{colors.$secondary-background-selected};
--red-ui-secondary-background-inactive: #{colors.$secondary-background-inactive};
--red-ui-secondary-background-hover: #{colors.$secondary-background-hover};
--red-ui-secondary-background-disabled: #{colors.$secondary-background-disabled};
--red-ui-tertiary-background: #{$tertiary-background};
--red-ui-tertiary-background: #{colors.$tertiary-background};
--red-ui-shadow: #{$shadow};
--red-ui-shadow: #{colors.$shadow};
// Header Height
--red-ui-header-height: #{$header-height};
--red-ui-header-height: #{sizes.$header-height};
// Main body text
--red-ui-primary-text-color: #{$primary-text-color};
--red-ui-primary-text-color: #{colors.$primary-text-color};
// UI control label text
--red-ui-secondary-text-color: #{$secondary-text-color};
--red-ui-secondary-text-color-focus: #{$secondary-text-color-focus};
--red-ui-secondary-text-color-hover: #{$secondary-text-color-hover};
--red-ui-secondary-text-color-active: #{$secondary-text-color-active};
--red-ui-secondary-text-color-selected: #{$secondary-text-color-selected};
--red-ui-secondary-text-color-inactive: #{$secondary-text-color-inactive};
--red-ui-secondary-text-color-disabled: #{$secondary-text-color-disabled};
--red-ui-secondary-text-color-disabled-active: #{$secondary-text-color-disabled-active};
--red-ui-secondary-text-color-disabled-inactive: #{$secondary-text-color-disabled-inactive};
--red-ui-secondary-text-color: #{colors.$secondary-text-color};
--red-ui-secondary-text-color-focus: #{colors.$secondary-text-color-focus};
--red-ui-secondary-text-color-hover: #{colors.$secondary-text-color-hover};
--red-ui-secondary-text-color-active: #{colors.$secondary-text-color-active};
--red-ui-secondary-text-color-selected: #{colors.$secondary-text-color-selected};
--red-ui-secondary-text-color-inactive: #{colors.$secondary-text-color-inactive};
--red-ui-secondary-text-color-disabled: #{colors.$secondary-text-color-disabled};
--red-ui-secondary-text-color-disabled-active: #{colors.$secondary-text-color-disabled-active};
--red-ui-secondary-text-color-disabled-inactive: #{colors.$secondary-text-color-disabled-inactive};
// Sub label text
--red-ui-tertiary-text-color: #{$tertiary-text-color};
--red-ui-tertiary-text-color: #{colors.$tertiary-text-color};
// Heading text
--red-ui-header-text-color: #{$header-text-color};
--red-ui-header-text-color: #{colors.$header-text-color};
--red-ui-text-color-error: #{$text-color-error};
--red-ui-text-color-warning: #{$text-color-warning};
--red-ui-text-color-success: #{$text-color-success};
--red-ui-text-color-code: #{$text-color-code};
--red-ui-text-color-link: #{$text-color-link};
--red-ui-text-color-error: #{colors.$text-color-error};
--red-ui-text-color-warning: #{colors.$text-color-warning};
--red-ui-text-color-success: #{colors.$text-color-success};
--red-ui-text-color-code: #{colors.$text-color-code};
--red-ui-text-color-link: #{colors.$text-color-link};
--red-ui-primary-border-color: #{$primary-border-color};
--red-ui-secondary-border-color: #{$secondary-border-color};
--red-ui-tertiary-border-color: #{$tertiary-border-color};
--red-ui-primary-border-color: #{colors.$primary-border-color};
--red-ui-secondary-border-color: #{colors.$secondary-border-color};
--red-ui-tertiary-border-color: #{colors.$tertiary-border-color};
--red-ui-border-color-error: #{$border-color-error};
--red-ui-border-color-warning: #{$border-color-warning};
--red-ui-border-color-success: #{$border-color-success};
--red-ui-border-color-error: #{colors.$border-color-error};
--red-ui-border-color-warning: #{colors.$border-color-warning};
--red-ui-border-color-success: #{colors.$border-color-success};
--red-ui-form-background: #{$form-background};
--red-ui-form-placeholder-color: #{$form-placeholder-color};
--red-ui-form-text-color: #{$form-text-color};
--red-ui-form-text-color-disabled: #{$form-text-color-disabled};
--red-ui-form-input-focus-color: #{$form-input-focus-color};
--red-ui-form-input-border-color: #{$form-input-border-color};
--red-ui-form-input-border-selected-color: #{$form-input-border-selected-color};
--red-ui-form-input-border-error-color: #{$form-input-border-error-color};
--red-ui-form-input-background: #{$form-input-background};
--red-ui-form-input-background-disabled: #{$form-input-background-disabled};
--red-ui-form-button-background: #{$form-button-background};
--red-ui-form-background: #{colors.$form-background};
--red-ui-form-placeholder-color: #{colors.$form-placeholder-color};
--red-ui-form-text-color: #{colors.$form-text-color};
--red-ui-form-text-color-disabled: #{colors.$form-text-color-disabled};
--red-ui-form-input-focus-color: #{colors.$form-input-focus-color};
--red-ui-form-input-border-color: #{colors.$form-input-border-color};
--red-ui-form-input-border-selected-color: #{colors.$form-input-border-selected-color};
--red-ui-form-input-border-error-color: #{colors.$form-input-border-error-color};
--red-ui-form-input-background: #{colors.$form-input-background};
--red-ui-form-input-background-disabled: #{colors.$form-input-background-disabled};
--red-ui-form-button-background: #{colors.$form-button-background};
--red-ui-form-tips-background: #{$form-tips-background};
--red-ui-form-tips-background: #{colors.$form-tips-background};
--red-ui-text-editor-color: #{$text-editor-color};
--red-ui-text-editor-background: #{$text-editor-background};
--red-ui-text-editor-color-disabled: #{$text-editor-color-disabled};
--red-ui-text-editor-background-disabled: #{$text-editor-background-disabled};
--red-ui-text-editor-gutter-background: #{$text-editor-gutter-background};
--red-ui-text-editor-gutter-color: #{$text-editor-gutter-color};
--red-ui-text-editor-gutter-active-line-background: #{$text-editor-gutter-active-line-background};
--red-ui-text-editor-active-line-background: #{$text-editor-active-line-background};
--red-ui-text-editor-selection-background: #{$text-editor-selection-background};
--red-ui-text-editor-color: #{colors.$text-editor-color};
--red-ui-text-editor-background: #{colors.$text-editor-background};
--red-ui-text-editor-color-disabled: #{colors.$text-editor-color-disabled};
--red-ui-text-editor-background-disabled: #{colors.$text-editor-background-disabled};
--red-ui-text-editor-gutter-background: #{colors.$text-editor-gutter-background};
--red-ui-text-editor-gutter-color: #{colors.$text-editor-gutter-color};
--red-ui-text-editor-gutter-active-line-background: #{colors.$text-editor-gutter-active-line-background};
--red-ui-text-editor-active-line-background: #{colors.$text-editor-active-line-background};
--red-ui-text-editor-selection-background: #{colors.$text-editor-selection-background};
--red-ui-event-log-background: #{$event-log-background};
--red-ui-event-log-color: #{$event-log-color};
--red-ui-event-log-active-line-background: #{$event-log-active-line-background};
--red-ui-event-log-selection-background: #{$event-log-selection-background};
--red-ui-event-log-background: #{colors.$event-log-background};
--red-ui-event-log-color: #{colors.$event-log-color};
--red-ui-event-log-active-line-background: #{colors.$event-log-active-line-background};
--red-ui-event-log-selection-background: #{colors.$event-log-selection-background};
--red-ui-list-item-color: #{$list-item-color};
--red-ui-list-item-secondary-color: #{$list-item-secondary-color};
--red-ui-list-item-background: #{$list-item-background};
--red-ui-list-item-background-disabled: #{$list-item-background-disabled};
--red-ui-list-item-background-hover: #{$list-item-background-hover};
--red-ui-list-item-background-selected: #{$list-item-background-selected};
--red-ui-list-item-border-selected: #{$list-item-border-selected};
--red-ui-list-item-color: #{colors.$list-item-color};
--red-ui-list-item-secondary-color: #{colors.$list-item-secondary-color};
--red-ui-list-item-background: #{colors.$list-item-background};
--red-ui-list-item-background-disabled: #{colors.$list-item-background-disabled};
--red-ui-list-item-background-hover: #{colors.$list-item-background-hover};
--red-ui-list-item-background-selected: #{colors.$list-item-background-selected};
--red-ui-list-item-border-selected: #{colors.$list-item-border-selected};
--red-ui-tab-text-color-active: #{$tab-text-color-active};
--red-ui-tab-text-color-inactive: #{$tab-text-color-inactive};
--red-ui-tab-text-color-disabled-active: #{$tab-text-color-disabled-active};
--red-ui-tab-text-color-disabled-inactive: #{$tab-text-color-disabled-inactive};
--red-ui-tab-text-color-active: #{colors.$tab-text-color-active};
--red-ui-tab-text-color-inactive: #{colors.$tab-text-color-inactive};
--red-ui-tab-text-color-disabled-active: #{colors.$tab-text-color-disabled-active};
--red-ui-tab-text-color-disabled-inactive: #{colors.$tab-text-color-disabled-inactive};
--red-ui-tab-badge-color: #{$tab-badge-color};
--red-ui-tab-background: #{$tab-background};
--red-ui-tab-background-active: #{$tab-background-active};
--red-ui-tab-background-active-alpha: #{$tab-background-active-alpha};
--red-ui-tab-background-selected: #{$tab-background-selected};
--red-ui-tab-background-selected-alpha: #{$tab-background-selected-alpha};
--red-ui-tab-background-inactive: #{$tab-background-inactive};
--red-ui-tab-background-inactive-alpha: #{$tab-background-inactive-alpha};
--red-ui-tab-background-hover: #{$tab-background-hover};
--red-ui-tab-background-hover-alpha: #{$tab-background-hover-alpha};
--red-ui-tab-badge-color: #{colors.$tab-badge-color};
--red-ui-tab-background: #{colors.$tab-background};
--red-ui-tab-background-active: #{colors.$tab-background-active};
--red-ui-tab-background-active-alpha: #{colors.$tab-background-active-alpha};
--red-ui-tab-background-selected: #{colors.$tab-background-selected};
--red-ui-tab-background-selected-alpha: #{colors.$tab-background-selected-alpha};
--red-ui-tab-background-inactive: #{colors.$tab-background-inactive};
--red-ui-tab-background-inactive-alpha: #{colors.$tab-background-inactive-alpha};
--red-ui-tab-background-hover: #{colors.$tab-background-hover};
--red-ui-tab-background-hover-alpha: #{colors.$tab-background-hover-alpha};
--red-ui-palette-header-background: #{$palette-header-background};
--red-ui-palette-header-color: #{$palette-header-color};
--red-ui-palette-content-background: #{$palette-content-background};
--red-ui-palette-header-background: #{colors.$palette-header-background};
--red-ui-palette-header-color: #{colors.$palette-header-color};
--red-ui-palette-content-background: #{colors.$palette-content-background};
--red-ui-workspace-button-background: #{$workspace-button-background};
--red-ui-workspace-button-background-hover: #{$workspace-button-background-hover};
--red-ui-workspace-button-background-active: #{$workspace-button-background-active};
--red-ui-workspace-button-background: #{colors.$workspace-button-background};
--red-ui-workspace-button-background-hover: #{colors.$workspace-button-background-hover};
--red-ui-workspace-button-background-active: #{colors.$workspace-button-background-active};
--red-ui-workspace-button-color: #{$workspace-button-color};
--red-ui-workspace-button-color-disabled: #{$workspace-button-color-disabled};
--red-ui-workspace-button-color-focus: #{$workspace-button-color-focus};
--red-ui-workspace-button-color-hover: #{$workspace-button-color-hover};
--red-ui-workspace-button-color-active: #{$workspace-button-color-active};
--red-ui-workspace-button-color-selected: #{$workspace-button-color-selected};
--red-ui-workspace-button-color: #{colors.$workspace-button-color};
--red-ui-workspace-button-color-disabled: #{colors.$workspace-button-color-disabled};
--red-ui-workspace-button-color-focus: #{colors.$workspace-button-color-focus};
--red-ui-workspace-button-color-hover: #{colors.$workspace-button-color-hover};
--red-ui-workspace-button-color-active: #{colors.$workspace-button-color-active};
--red-ui-workspace-button-color-selected: #{colors.$workspace-button-color-selected};
--red-ui-workspace-button-color-primary: #{$workspace-button-color-primary};
--red-ui-workspace-button-background-primary: #{$workspace-button-background-primary};
--red-ui-workspace-button-background-primary-hover: #{$workspace-button-background-primary-hover};
--red-ui-workspace-button-color-primary: #{colors.$workspace-button-color-primary};
--red-ui-workspace-button-background-primary: #{colors.$workspace-button-background-primary};
--red-ui-workspace-button-background-primary-hover: #{colors.$workspace-button-background-primary-hover};
--red-ui-workspace-button-color-focus-outline: #{$workspace-button-color-focus-outline};
--red-ui-workspace-button-color-focus-outline: #{colors.$workspace-button-color-focus-outline};
--red-ui-shade-color: #{$shade-color};
--red-ui-shade-color: #{colors.$shade-color};
--red-ui-popover-background: #{$popover-background};
--red-ui-popover-border: #{$popover-border};
--red-ui-popover-color: #{$popover-color};
--red-ui-popover-button-border-color: #{$popover-button-border-color};
--red-ui-popover-button-border-color-hover: #{$popover-button-border-color-hover};
--red-ui-popover-background: #{colors.$popover-background};
--red-ui-popover-border: #{colors.$popover-border};
--red-ui-popover-color: #{colors.$popover-color};
--red-ui-popover-button-border-color: #{colors.$popover-button-border-color};
--red-ui-popover-button-border-color-hover: #{colors.$popover-button-border-color-hover};
--red-ui-diff-text-header-color: #{$diff-text-header-color};
--red-ui-diff-text-header-background: #{$diff-text-header-background};
--red-ui-diff-state-color: #{$diff-state-color};
--red-ui-diff-state-prefix-color: #{$diff-state-prefix-color};
--red-ui-diff-state-added: #{$diff-state-added};
--red-ui-diff-state-deleted: #{$diff-state-deleted};
--red-ui-diff-state-changed: #{$diff-state-changed};
--red-ui-diff-state-changed-background: #{$diff-state-changed-background};
--red-ui-diff-state-unchanged: #{$diff-state-unchanged};
--red-ui-diff-state-unchanged-background: #{$diff-state-unchanged-background};
--red-ui-diff-text-header-color: #{colors.$diff-text-header-color};
--red-ui-diff-text-header-background: #{colors.$diff-text-header-background};
--red-ui-diff-state-color: #{colors.$diff-state-color};
--red-ui-diff-state-prefix-color: #{colors.$diff-state-prefix-color};
--red-ui-diff-state-added: #{colors.$diff-state-added};
--red-ui-diff-state-deleted: #{colors.$diff-state-deleted};
--red-ui-diff-state-changed: #{colors.$diff-state-changed};
--red-ui-diff-state-changed-background: #{colors.$diff-state-changed-background};
--red-ui-diff-state-unchanged: #{colors.$diff-state-unchanged};
--red-ui-diff-state-unchanged-background: #{colors.$diff-state-unchanged-background};
--red-ui-diff-state-conflicted: #{$diff-state-conflicted};
--red-ui-diff-state-moved: #{$diff-state-moved};
--red-ui-diff-state-conflict: #{$diff-state-conflict};
--red-ui-diff-state-conflict-background: #{$diff-state-conflict-background};
--red-ui-diff-state-conflicted: #{colors.$diff-state-conflicted};
--red-ui-diff-state-moved: #{colors.$diff-state-moved};
--red-ui-diff-state-conflict: #{colors.$diff-state-conflict};
--red-ui-diff-state-conflict-background: #{colors.$diff-state-conflict-background};
--red-ui-diff-state-added-background: #{$diff-state-added-background};
--red-ui-diff-state-added-border: #{$diff-state-added-border};
--red-ui-diff-state-added-header-background: #{$diff-state-added-header-background};
--red-ui-diff-state-added-header-border: #{$diff-state-added-header-border};
--red-ui-diff-state-added-background: #{colors.$diff-state-added-background};
--red-ui-diff-state-added-border: #{colors.$diff-state-added-border};
--red-ui-diff-state-added-header-background: #{colors.$diff-state-added-header-background};
--red-ui-diff-state-added-header-border: #{colors.$diff-state-added-header-border};
--red-ui-diff-state-deleted-background: #{$diff-state-deleted-background};
--red-ui-diff-state-deleted-border: #{$diff-state-deleted-border};
--red-ui-diff-state-deleted-header-background: #{$diff-state-deleted-header-background};
--red-ui-diff-state-deleted-header-border: #{$diff-state-deleted-header-border};
--red-ui-diff-state-deleted-background: #{colors.$diff-state-deleted-background};
--red-ui-diff-state-deleted-border: #{colors.$diff-state-deleted-border};
--red-ui-diff-state-deleted-header-background: #{colors.$diff-state-deleted-header-background};
--red-ui-diff-state-deleted-header-border: #{colors.$diff-state-deleted-header-border};
--red-ui-diff-merge-header-color: #{$diff-merge-header-color};
--red-ui-diff-merge-header-background: #{$diff-merge-header-background};
--red-ui-diff-merge-header-border-color: #{$diff-merge-header-border-color};
--red-ui-diff-merge-header-color: #{colors.$diff-merge-header-color};
--red-ui-diff-merge-header-background: #{colors.$diff-merge-header-background};
--red-ui-diff-merge-header-border-color: #{colors.$diff-merge-header-border-color};
--red-ui-menuBackground: #{$menuBackground};
--red-ui-menuDivider: #{$menuDivider};
--red-ui-menuColor: #{$menuColor};
--red-ui-menuActiveColor: #{$menuActiveColor};
--red-ui-menuActiveBackground: #{$menuActiveBackground};
--red-ui-menuDisabledColor: #{$menuDisabledColor};
--red-ui-menuHoverColor: #{$menuHoverColor};
--red-ui-menuHoverBackground: #{$menuHoverBackground};
--red-ui-menuCaret: #{$menuCaret};
--red-ui-menuBackground: #{colors.$menuBackground};
--red-ui-menuDivider: #{colors.$menuDivider};
--red-ui-menuColor: #{colors.$menuColor};
--red-ui-menuActiveColor: #{colors.$menuActiveColor};
--red-ui-menuActiveBackground: #{colors.$menuActiveBackground};
--red-ui-menuDisabledColor: #{colors.$menuDisabledColor};
--red-ui-menuHoverColor: #{colors.$menuHoverColor};
--red-ui-menuHoverBackground: #{colors.$menuHoverBackground};
--red-ui-menuCaret: #{colors.$menuCaret};
--red-ui-view-navigator-background: #{$view-navigator-background};
--red-ui-view-navigator-background: #{colors.$view-navigator-background};
--red-ui-view-lasso-stroke: #{$view-lasso-stroke};
--red-ui-view-lasso-fill: #{$view-lasso-fill};
--red-ui-view-lasso-stroke: #{colors.$view-lasso-stroke};
--red-ui-view-lasso-fill: #{colors.$view-lasso-fill};
--red-ui-view-background: #{$view-background};
--red-ui-view-grid-color: #{$view-grid-color};
--red-ui-view-background: #{colors.$view-background};
--red-ui-view-grid-color: #{colors.$view-grid-color};
--red-ui-node-label-color: #{$node-label-color};
--red-ui-node-port-label-color: #{$node-port-label-color};
--red-ui-node-border: #{$node-border};
--red-ui-node-border-unknown: #{$node-border-unknown};
--red-ui-node-border-placeholder: #{$node-border-placeholder};
--red-ui-node-background-placeholder: #{$node-background-placeholder};
--red-ui-node-label-color: #{colors.$node-label-color};
--red-ui-node-port-label-color: #{colors.$node-port-label-color};
--red-ui-node-border: #{colors.$node-border};
--red-ui-node-border-unknown: #{colors.$node-border-unknown};
--red-ui-node-border-placeholder: #{colors.$node-border-placeholder};
--red-ui-node-background-placeholder: #{colors.$node-background-placeholder};
--red-ui-node-port-background: #{$node-port-background};
--red-ui-node-port-background-hover: #{$node-port-background-hover};
--red-ui-node-icon-color: #{$node-icon-color};
--red-ui-node-icon-background-color: #{$node-icon-background-color};
--red-ui-node-icon-background-color-fill: #{$node-icon-background-color-fill};
--red-ui-node-icon-background-color-opacity: #{$node-icon-background-color-opacity};
--red-ui-node-icon-border-color: #{$node-icon-border-color};
--red-ui-node-icon-border-color-opacity: #{$node-icon-border-color-opacity};
--red-ui-node-port-background: #{colors.$node-port-background};
--red-ui-node-port-background-hover: #{colors.$node-port-background-hover};
--red-ui-node-icon-color: #{colors.$node-icon-color};
--red-ui-node-icon-background-color: #{colors.$node-icon-background-color};
--red-ui-node-icon-background-color-fill: #{colors.$node-icon-background-color-fill};
--red-ui-node-icon-background-color-opacity: #{colors.$node-icon-background-color-opacity};
--red-ui-node-icon-border-color: #{colors.$node-icon-border-color};
--red-ui-node-icon-border-color-opacity: #{colors.$node-icon-border-color-opacity};
--red-ui-node-config-background: #{$node-config-background};
--red-ui-node-config-icon-container-disabled: #{$node-config-icon-container-disabled};
--red-ui-node-config-background: #{colors.$node-config-background};
--red-ui-node-config-icon-container-disabled: #{colors.$node-config-icon-container-disabled};
--red-ui-node-link-port-background: #{$node-link-port-background};
--red-ui-node-link-port-background: #{colors.$node-link-port-background};
--red-ui-node-status-error-border: #{$node-status-error-border};
--red-ui-node-status-error-background: #{$node-status-error-background};
--red-ui-node-status-changed-border: #{$node-status-changed-border};
--red-ui-node-status-changed-background: #{$node-status-changed-background};
--red-ui-node-status-error-border: #{colors.$node-status-error-border};
--red-ui-node-status-error-background: #{colors.$node-status-error-background};
--red-ui-node-status-changed-border: #{colors.$node-status-changed-border};
--red-ui-node-status-changed-background: #{colors.$node-status-changed-background};
@each $current-color in red green yellow blue grey gray {
--red-ui-node-status-colors-#{"" + $current-color}: #{map-get($node-status-colors, $current-color)};
--red-ui-node-status-colors-#{"" + $current-color}: #{map.get(colors.$node-status-colors, $current-color)};
}
--red-ui-node-selected-color: #{$node-selected-color};
--red-ui-port-selected-color: #{$port-selected-color};
--red-ui-node-selected-color: #{colors.$node-selected-color};
--red-ui-port-selected-color: #{colors.$port-selected-color};
--red-ui-link-color: #{$link-color};
--red-ui-link-link-color: #{$link-link-color};
--red-ui-link-disabled-color: #{$link-disabled-color};
--red-ui-link-link-active-color: #{$link-link-active-color};
--red-ui-link-unknown-color: #{$link-unknown-color};
--red-ui-link-color: #{colors.$link-color};
--red-ui-link-link-color: #{colors.$link-link-color};
--red-ui-link-disabled-color: #{colors.$link-disabled-color};
--red-ui-link-link-active-color: #{colors.$link-link-active-color};
--red-ui-link-unknown-color: #{colors.$link-unknown-color};
--red-ui-clipboard-textarea-background: #{$clipboard-textarea-background};
--red-ui-clipboard-textarea-background: #{colors.$clipboard-textarea-background};
--red-ui-deploy-button-color: #{$deploy-button-color};
--red-ui-deploy-button-color-active: #{$deploy-button-color-active};
--red-ui-deploy-button-color-disabled: #{$deploy-button-color-disabled};
--red-ui-deploy-button-background: #{$deploy-button-background};
--red-ui-deploy-button-background-hover: #{$deploy-button-background-hover};
--red-ui-deploy-button-background-active: #{$deploy-button-background-active};
--red-ui-deploy-button-background-disabled: #{$deploy-button-background-disabled};
--red-ui-deploy-button-background-disabled-hover: #{$deploy-button-background-disabled-hover};
--red-ui-deploy-button-color: #{colors.$deploy-button-color};
--red-ui-deploy-button-color-active: #{colors.$deploy-button-color-active};
--red-ui-deploy-button-color-disabled: #{colors.$deploy-button-color-disabled};
--red-ui-deploy-button-background: #{colors.$deploy-button-background};
--red-ui-deploy-button-background-hover: #{colors.$deploy-button-background-hover};
--red-ui-deploy-button-background-active: #{colors.$deploy-button-background-active};
--red-ui-deploy-button-background-disabled: #{colors.$deploy-button-background-disabled};
--red-ui-deploy-button-background-disabled-hover: #{colors.$deploy-button-background-disabled-hover};
--red-ui-header-background: #{$header-background};
--red-ui-header-accent: #{$header-accent};
--red-ui-header-button-background-active: #{$header-button-background-active};
--red-ui-header-menu-color: #{$header-menu-color};
--red-ui-header-menu-color-disabled: #{$header-menu-color-disabled};
--red-ui-header-menu-heading-color: #{$header-menu-heading-color};
--red-ui-header-menu-sublabel-color: #{$header-menu-sublabel-color};
--red-ui-header-menu-background: #{$header-menu-background};
--red-ui-header-menu-item-hover: #{$header-menu-item-hover};
--red-ui-header-menu-item-border-active: #{$header-menu-item-border-active};
--red-ui-headerMenuItemDivider: #{$headerMenuItemDivider};
--red-ui-headerMenuCaret: #{$headerMenuCaret};
--red-ui-header-background: #{colors.$header-background};
--red-ui-header-accent: #{colors.$header-accent};
--red-ui-header-button-background-active: #{colors.$header-button-background-active};
--red-ui-header-menu-color: #{colors.$header-menu-color};
--red-ui-header-menu-color-disabled: #{colors.$header-menu-color-disabled};
--red-ui-header-menu-heading-color: #{colors.$header-menu-heading-color};
--red-ui-header-menu-sublabel-color: #{colors.$header-menu-sublabel-color};
--red-ui-header-menu-background: #{colors.$header-menu-background};
--red-ui-header-menu-item-hover: #{colors.$header-menu-item-hover};
--red-ui-header-menu-item-border-active: #{colors.$header-menu-item-border-active};
--red-ui-headerMenuItemDivider: #{colors.$headerMenuItemDivider};
--red-ui-headerMenuCaret: #{colors.$headerMenuCaret};
--red-ui-vcCommitShaColor: #{$vcCommitShaColor};
--red-ui-vcCommitShaColor: #{colors.$vcCommitShaColor};
--red-ui-dnd-background: #{$dnd-background};
--red-ui-dnd-color: #{$dnd-color};
--red-ui-dnd-background: #{colors.$dnd-background};
--red-ui-dnd-color: #{colors.$dnd-color};
--red-ui-notification-border-default: #{$notification-border-default};
--red-ui-notification-border-success: #{$notification-border-success};
--red-ui-notification-border-warning: #{$notification-border-warning};
--red-ui-notification-border-error: #{$notification-border-error};
--red-ui-notification-border-default: #{colors.$notification-border-default};
--red-ui-notification-border-success: #{colors.$notification-border-success};
--red-ui-notification-border-warning: #{colors.$notification-border-warning};
--red-ui-notification-border-error: #{colors.$notification-border-error};
--red-ui-debug-message-background: #{$debug-message-background};
--red-ui-debug-message-background-hover: #{$debug-message-background-hover};
--red-ui-debug-message-background: #{colors.$debug-message-background};
--red-ui-debug-message-background-hover: #{colors.$debug-message-background-hover};
--red-ui-debug-message-text-color: #{$debug-message-text-color};
--red-ui-debug-message-text-color-meta: #{$debug-message-text-color-meta};
--red-ui-debug-message-text-color-object-key: #{$debug-message-text-color-object-key};
--red-ui-debug-message-text-color-msg-type-other: #{$debug-message-text-color-msg-type-other};
--red-ui-debug-message-text-color-msg-type-string: #{$debug-message-text-color-msg-type-string};
--red-ui-debug-message-text-color-msg-type-null: #{$debug-message-text-color-msg-type-null};
--red-ui-debug-message-text-color-msg-type-meta: #{$debug-message-text-color-msg-type-meta};
--red-ui-debug-message-text-color-msg-type-number: #{$debug-message-text-color-msg-type-number};
--red-ui-debug-message-text-color: #{colors.$debug-message-text-color};
--red-ui-debug-message-text-color-meta: #{colors.$debug-message-text-color-meta};
--red-ui-debug-message-text-color-object-key: #{colors.$debug-message-text-color-object-key};
--red-ui-debug-message-text-color-msg-type-other: #{colors.$debug-message-text-color-msg-type-other};
--red-ui-debug-message-text-color-msg-type-string: #{colors.$debug-message-text-color-msg-type-string};
--red-ui-debug-message-text-color-msg-type-null: #{colors.$debug-message-text-color-msg-type-null};
--red-ui-debug-message-text-color-msg-type-meta: #{colors.$debug-message-text-color-msg-type-meta};
--red-ui-debug-message-text-color-msg-type-number: #{colors.$debug-message-text-color-msg-type-number};
--red-ui-debug-message-border: #{$debug-message-border};
--red-ui-debug-message-border-hover: #{$debug-message-border-hover};
--red-ui-debug-message-border-warning: #{$debug-message-border-warning};
--red-ui-debug-message-border-error: #{$debug-message-border-error};
--red-ui-debug-message-border: #{colors.$debug-message-border};
--red-ui-debug-message-border-hover: #{colors.$debug-message-border-hover};
--red-ui-debug-message-border-warning: #{colors.$debug-message-border-warning};
--red-ui-debug-message-border-error: #{colors.$debug-message-border-error};
--red-ui-group-default-fill: #{$group-default-fill};
--red-ui-group-default-fill-opacity: #{$group-default-fill-opacity};
--red-ui-group-default-stroke: #{$group-default-stroke};
--red-ui-group-default-stroke-opacity: #{$group-default-stroke-opacity};
--red-ui-group-default-label-color: #{$group-default-label-color};
--red-ui-group-default-fill: #{colors.$group-default-fill};
--red-ui-group-default-fill-opacity: #{colors.$group-default-fill-opacity};
--red-ui-group-default-stroke: #{colors.$group-default-stroke};
--red-ui-group-default-stroke-opacity: #{colors.$group-default-stroke-opacity};
--red-ui-group-default-label-color: #{colors.$group-default-label-color};
--red-ui-tourGuide-border: #{$tourGuide-border};
--red-ui-tourGuide-heading-color: #{$tourGuide-heading-color};
--red-ui-tourGuide-border: #{colors.$tourGuide-border};
--red-ui-tourGuide-heading-color: #{colors.$tourGuide-heading-color};
--red-ui-grip-color: #{$grip-color};
--red-ui-grip-color: #{colors.$grip-color};
--red-ui-icons-flow-color: #{$icons-flow-color};
--red-ui-icons-flow-color: #{colors.$icons-flow-color};
--red-ui-spinner-color: #{$spinner-color};
--red-ui-spinner-color: #{colors.$spinner-color};
--red-ui-tab-icon-color: #{$tab-icon-color};
--red-ui-tab-icon-color: #{colors.$tab-icon-color};
@each $current-color in 1 2 3 4 5 {
--red-ui-user-profile-colors-#{"" + $current-color}: #{map-get($user-profile-colors, $current-color)};
--red-ui-user-profile-colors-#{"" + $current-color}: #{map.get(colors.$user-profile-colors, $current-color)};
}
}

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -22,7 +24,7 @@
bottom: 0px;
right: 322px;
overflow: hidden;
@include component-border;
@include mixins.component-border;
transition: left 0.1s ease-in-out;
}
@@ -40,7 +42,7 @@
}
}
#red-ui-workspace-tabs-shade {
@include shade;
@include mixins.shade;
z-index: 2;
bottom: auto;
height: 35px;
@@ -157,7 +159,7 @@
}
.red-ui-component-footer {
@include component-footer;
@include mixins.component-footer;
> .button-group {
display: inline-block;
@@ -176,12 +178,12 @@
a.red-ui-footer-button,
button.red-ui-footer-button {
@include component-footer-button;
@include mixins.component-footer-button;
}
a.red-ui-footer-button-toggle,
button.red-ui-footer-button-toggle {
@include component-footer-button-toggle;
@include mixins.component-footer-button-toggle;
}
.red-ui-statusbar-widget {

View File

@@ -1,3 +1,5 @@
@use "mixins";
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
@@ -32,7 +34,7 @@
white-space: nowrap;
transition: right 0.2s ease;
overflow: hidden;
@include disable-selection;
@include mixins.disable-selection;
label {
padding: 1px 8px;
@@ -44,12 +46,12 @@
padding: 0;
}
.button {
@include workspace-button;
@include mixins.workspace-button;
margin-right: 10px;
padding: 2px 8px;
}
.button-group {
@include disable-selection;
@include mixins.disable-selection;
.button:first-child {
margin-right: 0;

View File

@@ -0,0 +1,231 @@
export default {
version: "4.0.0",
steps: [
{
titleIcon: "fa fa-map-o",
title: {
"en-US": "Welcome to Node-RED 4.0!",
"ja": "Node-RED 4.0 へようこそ!",
"fr": "Bienvenue dans Node-RED 4.0!"
},
description: {
"en-US": "<p>Let's take a moment to discover the new features in this release.</p>",
"ja": "<p>本リリースの新機能を見つけてみましょう。</p>",
"fr": "<p>Prenons un moment pour découvrir les nouvelles fonctionnalités de cette version.</p>"
}
},
{
title: {
"en-US": "Multiplayer Mode",
"ja": "複数ユーザ同時利用モード",
"fr": "Mode Multi-utilisateur"
},
image: '4.0/images/nr4-multiplayer-location.png',
description: {
"en-US": `<p>This release includes the first small steps towards making Node-RED easier
to work with when you have multiple people editing flows at the same time.</p>
<p>When this feature is enabled, you will now see who else has the editor open and some
basic information on where they are in the editor.</p>
<p>Check the release post for details on how to enable this feature in your settings file.</p>`,
"ja": `<p>本リリースには、複数ユーザが同時にフローを編集する時に、Node-REDをより使いやすくするのための最初の微修正が入っています。</p>
<p>本機能を有効にすると、誰がエディタを開いているか、その人がエディタ上のどこにいるかの基本的な情報が表示されます。</p>
<p>設定ファイルで本機能を有効化する方法の詳細は、リリースの投稿を確認してください。</p>`,
"fr": `<p>Cette version inclut les premières étapes visant à rendre Node-RED plus facile à utiliser
lorsque plusieurs personnes modifient des flux en même temps.</p>
<p>Lorsque cette fonctionnalité est activée, vous pourrez désormais voir si dautres utilisateurs ont
ouvert l'éditeur. Vous pourrez également savoir où ces utilisateurs se trouvent dans l'éditeur.</p>
<p>Consultez la note de publication pour plus de détails sur la façon d'activer cette fonctionnalité
dans votre fichier de paramètres.</p>`
}
},
{
title: {
"en-US": "Better background deploy handling",
"ja": "バックグラウンドのデプロイ処理の改善",
"fr": "Meilleure gestion du déploiement en arrière-plan"
},
image: '4.0/images/nr4-background-deploy.png',
description: {
"en-US": `<p>If another user deploys changes whilst you are editing, we now use a more discrete notification
that doesn't stop you continuing your work - especially if they are being very productive and deploying lots
of changes.</p>`,
"ja": `他のユーザが変更をデプロイした時に、特に変更が多い生産的な編集作業を妨げないように通知するようになりました。`,
"fr": `<p>Si un autre utilisateur déploie des modifications pendant que vous êtes en train de modifier, vous recevrez
une notification plus discrète qu'auparavant qui ne vous empêche pas de continuer votre travail.</p>`
}
},
{
title: {
"en-US": "Improved flow diffs",
"ja": "フローの差分表示の改善",
"fr": "Amélioration des différences de flux"
},
image: '4.0/images/nr4-diff-update.png',
description: {
"en-US": `<p>When viewing changes made to a flow, Node-RED now distinguishes between nodes that have had configuration
changes and those that have only been moved.<p>
<p>When faced with a long list of changes to look at, this makes it much easier to focus on more significant items.</p>`,
"ja": `<p>フローの変更内容を表示する時に、Node-REDは設定が変更されたードと、移動されただけのードを区別するようになりました。<p>
<p>これによって、多くの変更内容を確認する際に、重要な項目に焦点を当てることができます。</p>`,
"fr": `<p>Lors de l'affichage des modifications apportées à un flux, Node-RED fait désormais la distinction entre les
noeuds qui ont changé de configuration et ceux qui ont seulement été déplacés.<p>
<p>Face à une longue liste de changements à examiner, il est beaucoup plus facile de se concentrer sur les éléments les
plus importants.</p>`
}
},
{
title: {
"en-US": "Better Configuration Node UX",
"ja": "設定ードのUXが向上",
"fr": "Meilleure expérience utilisateur du noeud de configuration"
},
image: '4.0/images/nr4-config-select.png',
description: {
"en-US": `<p>The Configuration node selection UI has had a small update to have a dedicated 'add' button
next to the select box.</p>
<p>It's a small change, but should make it easier to work with your config nodes.</p>`,
"ja": `<p>設定ードを選択するUIが修正され、選択ボックスの隣に専用の「追加」ボタンが追加されました。</p>
<p>微修正ですが設定ノードの操作が容易になります。</p>`,
"fr": `<p>L'interface utilisateur de la sélection du noeud de configuration a fait l'objet d'une petite
mise à jour afin de disposer d'un bouton « Ajouter » à côté de la zone de sélection.</p>
<p>C'est un petit changement, mais cela devrait faciliter le travail avec vos noeuds de configuration.</p>`
}
},
{
title: {
"en-US": "Timestamp formatting options",
"ja": "タイムスタンプの形式の項目",
"fr": "Options de formatage de l'horodatage"
},
image: '4.0/images/nr4-timestamp-formatting.png',
description: {
"en-US": `<p>Nodes that let you set a timestamp now have options on what format that timestamp should be in.</p>
<p>We're keeping it simple to begin with by providing three options:<p>
<ul>
<li>Milliseconds since epoch - this is existing behaviour of the timestamp option</li>
<li>ISO 8601 - a common format used by many systems</li>
<li>JavaScript Date Object</li>
</ul>`,
"ja": `<p>タイムスタンプを設定するノードに、タイムスタンプの形式を指定できる項目が追加されました。</p>
<p>次の3つの項目を追加したことで、簡単に選択できるようになりました:<p>
<ul>
<li>エポックからのミリ秒 - 従来動作と同じになるタイムスタンプの項目</li>
<li>ISO 8601 - 多くのシステムで使用されている共通の形式</li>
<li>JavaScript日付オブジェクト</li>
</ul>`,
"fr": `<p>Les noeuds qui vous permettent de définir un horodatage disposent désormais d'options sur le format dans lequel cet horodatage peut être défini.</p>
<p>Nous gardons les choses simples en proposant trois options :<p>
<ul>
<li>Millisecondes depuis l'époque : il s'agit du comportement existant de l'option d'horodatage</li>
<li>ISO 8601 : un format commun utilisé par de nombreux systèmes</li>
<li>Objet Date JavaScript</li>
</ul>`
}
},
{
title: {
"en-US": "Auto-complete of flow/global and env types",
"ja": "フロー/グローバル、環境変数の型の自動補完",
"fr": "Saisie automatique des types de flux/global et env"
},
image: '4.0/images/nr4-auto-complete.png',
description: {
"en-US": `<p>The <code>flow</code>/<code>global</code> context inputs and the <code>env</code> input
now all include auto-complete suggestions based on the live state of your flows.</p>
`,
"ja": `<p><code>flow</code>/<code>global</code>コンテキストや<code>env</code>の入力を、現在のフローの状態をもとに自動補完で提案するようになりました。</p>
`,
"fr": `<p>Les entrées contextuelles <code>flow</code>/<code>global</code> et l'entrée <code>env</code>
incluent désormais des suggestions de saisie semi-automatique basées sur l'état actuel de vos flux.</p>
`,
}
},
{
title: {
"en-US": "Config node customisation in Subflows",
"ja": "サブフローでの設定ノードのカスタマイズ",
"fr": "Personnalisation du noeud de configuration dans les sous-flux"
},
image: '4.0/images/nr4-sf-config.png',
description: {
"en-US": `<p>Subflows can now be customised to allow each instance to use a different
config node of a selected type.</p>
<p>For example, each instance of a subflow that connects to an MQTT Broker and does some post-processing
of the messages received can be pointed at a different broker.</p>
`,
"ja": `<p>サブフローをカスタマイズして、選択した型の異なる設定ノードを各インスタンスが使用できるようになりました。</p>
<p>例えば、MQTTブローカへ接続し、メッセージ受信と後処理を行うサブフローの各インスタンスに異なるブローカを指定することも可能です。</p>
`,
"fr": `<p>Les sous-flux peuvent désormais être personnalisés pour permettre à chaque instance d'utiliser un
noeud de configuration d'un type sélectionné.</p>
<p>Par exemple, chaque instance d'un sous-flux qui se connecte à un courtier MQTT et effectue un post-traitement
des messages reçus peut être pointée vers un autre courtier.</p>
`
}
},
{
title: {
"en-US": "Remembering palette state",
"ja": "パレットの状態を維持",
"fr": "Mémorisation de l'état de la palette"
},
description: {
"en-US": `<p>The palette now remembers what categories you have hidden between reloads - as well as any
filter you have applied.</p>`,
"ja": `<p>パレット上で非表示にしたカテゴリや適用したフィルタが、リロードしても記憶されるようになりました。</p>`,
"fr": `<p>La palette se souvient désormais des catégories que vous avez masquées entre les rechargements,
ainsi que le filtre que vous avez appliqué.</p>`
}
},
{
title: {
"en-US": "Plugins shown in the Palette Manager",
"ja": "パレット管理にプラグインを表示",
"fr": "Affichage des Plugins dans le gestionnaire de palettes"
},
image: '4.0/images/nr4-plugins.png',
description: {
"en-US": `<p>The palette manager now shows any plugin modules you have installed, such as
<code>node-red-debugger</code>. Previously they would only be shown if the plugins include
nodes for the palette.</p>`,
"ja": `<p>パレットの管理に <code>node-red-debugger</code> の様なインストールしたプラグインが表示されます。以前はプラグインにパレット向けのノードが含まれている時のみ表示されていました。</p>`,
"fr": `<p>Le gestionnaire de palettes affiche désormais tous les plugins que vous avez installés,
tels que <code>node-red-debugger</code>. Auparavant, ils n'étaient affichés que s'ils contenaient
des noeuds pour la palette.</p>`
}
},
{
title: {
"en-US": "Node Updates",
"ja": "ノードの更新",
"fr": "Mises à jour des noeuds"
},
// image: "images/",
description: {
"en-US": `<p>The core nodes have received lots of minor fixes, documentation updates and
small enhancements. Check the full changelog in the Help sidebar for a full list.</p>
<ul>
<li>A fully RFC4180 compliant CSV mode</li>
<li>Customisable headers on the WebSocket node</li>
<li>Split node now can operate on any message property</li>
<li>and lots more...</li>
</ul>`,
"ja": `<p>コアノードには沢山の軽微な修正、ドキュメント更新、小さな機能拡張が入っています。全リストはヘルプサイドバーにある変更履歴を参照してください。</p>
<ul>
<li>RFC4180に完全に準拠したCSVモード</li>
<li>WebSocketードのカスタマイズ可能なヘッダ</li>
<li>Splitードは、メッセージプロパティで操作できるようになりました</li>
<li>他にも沢山あります...</li>
</ul>`,
"fr": `<p>Les noeuds principaux ont reçu de nombreux correctifs mineurs ainsi que des améliorations. La documentation a été mise à jour.
Consultez le journal des modifications dans la barre latérale d'aide pour une liste complète. Ci-dessous, les changements les plus importants :</p>
<ul>
<li>Un mode CSV entièrement conforme à la norme RFC4180</li>
<li>En-têtes personnalisables pour le noeud WebSocket</li>
<li>Le noeud Split peut désormais fonctionner sur n'importe quelle propriété de message</li>
<li>Et bien plus encore...</li>
</ul>`
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1,12 +1,12 @@
export default {
version: "4.0.0",
version: "4.1.0",
steps: [
{
titleIcon: "fa fa-map-o",
title: {
"en-US": "Welcome to Node-RED 4.0!",
"ja": "Node-RED 4.0 へようこそ!",
"fr": "Bienvenue dans Node-RED 4.0!"
"en-US": "Welcome to Node-RED 4.1!",
"ja": "Node-RED 4.1 へようこそ!",
"fr": "Bienvenue dans Node-RED 4.1!"
},
description: {
"en-US": "<p>Let's take a moment to discover the new features in this release.</p>",
@@ -16,184 +16,79 @@ export default {
},
{
title: {
"en-US": "Multiplayer Mode",
"ja": "複数ユーザ同時利用モード",
"fr": "Mode Multi-utilisateur"
"en-US": "Update notifications",
"ja": "更新の通知",
"fr": "Notifications de mise à jour"
},
image: 'images/nr4-multiplayer-location.png',
image: 'images/update-notification.png',
description: {
"en-US": `<p>This release includes the first small steps towards making Node-RED easier
to work with when you have multiple people editing flows at the same time.</p>
<p>When this feature is enabled, you will now see who else has the editor open and some
basic information on where they are in the editor.</p>
<p>Check the release post for details on how to enable this feature in your settings file.</p>`,
"ja": `<p>本リリースには、複数ユーザが同時にフローを編集する時に、Node-REDをより使いやすくするのための最初の微修正が入っています。</p>
<p>本機能を有効にすると、誰がエディタを開いているか、その人がエディタ上のどこにいるかの基本的な情報が表示されます。</p>
<p>設定ファイルで本機能を有効化する方法の詳細は、リリースの投稿を確認してください。</p>`,
"fr": `<p>Cette version inclut les premières étapes visant à rendre Node-RED plus facile à utiliser
lorsque plusieurs personnes modifient des flux en même temps.</p>
<p>Lorsque cette fonctionnalité est activée, vous pourrez désormais voir si dautres utilisateurs ont
ouvert l'éditeur. Vous pourrez également savoir où ces utilisateurs se trouvent dans l'éditeur.</p>
<p>Consultez la note de publication pour plus de détails sur la façon d'activer cette fonctionnalité
dans votre fichier de paramètres.</p>`
"en-US": `<p>Stay up to date with notifications when there is a new Node-RED version available, or updates to the nodes you have installed</p>`,
"ja": `<p>新バージョンのNode-REDの提供や、インストールしたードの更新があった時に、通知を受け取ることができます。</p>`,
"fr": `<p>Désormais vous recevrez une notification lorsqu'une nouvelle version de Node-RED ou une nouvelle version relative à un des noeuds que vous avez installés est disponible</p>`
}
},
{
title: {
"en-US": "Better background deploy handling",
"ja": "バックグラウンドのデプロイ処理の改善",
"fr": "Meilleure gestion du déploiement en arrière-plan"
"en-US": "Flow documentation",
"ja": "フローのドキュメント",
"fr": "Documentation des flux"
},
image: 'images/nr4-background-deploy.png',
image: 'images/node-docs.png',
description: {
"en-US": `<p>If another user deploys changes whilst you are editing, we now use a more discrete notification
that doesn't stop you continuing your work - especially if they are being very productive and deploying lots
of changes.</p>`,
"ja": `他のユーザが変更をデプロイした時に、特に変更が多い生産的な編集作業を妨げないように通知するようになりました。`,
"fr": `<p>Si un autre utilisateur déploie des modifications pendant que vous êtes en train de modifier, vous recevrez
une notification plus discrète qu'auparavant qui ne vous empêche pas de continuer votre travail.</p>`
"en-US": `<p>Quickly see which nodes have additional documentation with the new documentation icon.</p>
<p>Clicking on the icon opens up the Description tab of the node edit dialog.</p>`,
"ja": `<p>ドキュメントアイコンによって、どのノードにドキュメントが追加されているかをすぐに確認できます。</p>
<p>アイコンをクリックすると、ノード編集ダイアログの説明タブが開きます。</p>`,
"fr": `<p>Voyez rapidement quels noeuds ont une documentation supplémentaire avec la nouvelle icône de documentation.</p>
<p>Cliquer sur l'icône ouvre l'onglet Description de la boîte de dialogue d'édition du noeud.</p>`
}
},
{
title: {
"en-US": "Improved flow diffs",
"ja": "フローの差分表示の改善",
"fr": "Amélioration des différences de flux"
"en-US": "Palette Manager Improvements",
"ja": "パレットの管理の改善",
"fr": "Améliorations du Gestionnaire de Palettes"
},
image: 'images/nr4-diff-update.png',
description: {
"en-US": `<p>When viewing changes made to a flow, Node-RED now distinguishes between nodes that have had configuration
changes and those that have only been moved.<p>
<p>When faced with a long list of changes to look at, this makes it much easier to focus on more significant items.</p>`,
"ja": `<p>フローの変更内容を表示する時に、Node-REDは設定が変更されたードと、移動されただけのードを区別するようになりました。<p>
<p>これによって、多くの変更内容を確認する際に、重要な項目に焦点を当てることができます。</p>`,
"fr": `<p>Lors de l'affichage des modifications apportées à un flux, Node-RED fait désormais la distinction entre les
noeuds qui ont changé de configuration et ceux qui ont seulement été déplacés.<p>
<p>Face à une longue liste de changements à examiner, il est beaucoup plus facile de se concentrer sur les éléments les
plus importants.</p>`
}
},
{
title: {
"en-US": "Better Configuration Node UX",
"ja": "設定ードのUXが向上",
"fr": "Meilleure expérience utilisateur du noeud de configuration"
},
image: 'images/nr4-config-select.png',
description: {
"en-US": `<p>The Configuration node selection UI has had a small update to have a dedicated 'add' button
next to the select box.</p>
<p>It's a small change, but should make it easier to work with your config nodes.</p>`,
"ja": `<p>設定ードを選択するUIが修正され、選択ボックスの隣に専用の「追加」ボタンが追加されました。</p>
<p>微修正ですが設定ノードの操作が容易になります。</p>`,
"fr": `<p>L'interface utilisateur de la sélection du noeud de configuration a fait l'objet d'une petite
mise à jour afin de disposer d'un bouton « Ajouter » à côté de la zone de sélection.</p>
<p>C'est un petit changement, mais cela devrait faciliter le travail avec vos noeuds de configuration.</p>`
}
},
{
title: {
"en-US": "Timestamp formatting options",
"ja": "タイムスタンプの形式の項目",
"fr": "Options de formatage de l'horodatage"
},
image: 'images/nr4-timestamp-formatting.png',
description: {
"en-US": `<p>Nodes that let you set a timestamp now have options on what format that timestamp should be in.</p>
<p>We're keeping it simple to begin with by providing three options:<p>
"en-US": `<p>There are lots of improvements to the palette manager:</p>
<ul>
<li>Milliseconds since epoch - this is existing behaviour of the timestamp option</li>
<li>ISO 8601 - a common format used by many systems</li>
<li>JavaScript Date Object</li>
<li>Search results are sorted by downloads to help you find the most popular nodes</li>
<li>See which nodes have been deprecated by their author and are no longer recommended for use</li>
<li>Links to node documentation for the nodes you already have installed</li>
</ul>`,
"ja": `<p>タイムスタンプを設定するノードに、タイムスタンプの形式を指定できる項目が追加されました</p>
<p>次の3つの項目を追加したことで、簡単に選択できるようになりました:<p>
"ja": `<p>パレットの管理に多くの改善が加えられました:</p>
<ul>
<li>エポックからのミリ秒 - 従来動作と同じになるタイムスタンプの項目</li>
<li>ISO 8601 - 多くのシステムで使用されている共通の形式</li>
<li>JavaScript日付オブジェクト</li>
<li>検索結果はダウンロード数順で並べられ、最も人気のあるノードを見つけやすくなりました。</li>
<li>作者によって非推奨とされ、利用が推奨されなくなったノードかを確認できるようになりました。</li>
<li>既にインストールされているノードに、ノードのドキュメントへのリンクが追加されました。</li>
</ul>`,
"fr": `<p>Les noeuds qui vous permettent de définir un horodatage disposent désormais d'options sur le format dans lequel cet horodatage peut être défini.</p>
<p>Nous gardons les choses simples en proposant trois options :<p>
"fr": `<p>Le Gestionnaire de Palettes a bénéficié de nombreuses améliorations :</p>
<ul>
<li>Millisecondes depuis l'époque : il s'agit du comportement existant de l'option d'horodatage</li>
<li>ISO 8601 : un format commun utilisé par de nombreux systèmes</li>
<li>Objet Date JavaScript</li>
<li>Les résultats de recherche sont triés par téléchargement pour vous aider à trouver les noeuds les plus populaires.</li>
<li>Indique les noeuds obsolètes par leur auteur et dont l'utilisation n'est plus recommandée.</li>
<li>Liens vers la documentation des noeuds déjà installés.</li>
</ul>`
}
},
{
title: {
"en-US": "Auto-complete of flow/global and env types",
"ja": "フロー/グローバル、環境変数の型の自動補完",
"fr": "Saisie automatique des types de flux/global et env"
"en-US": "Installing missing modules",
"ja": "不足モジュールのインストール",
"fr": "Installation des modules manquants"
},
image: 'images/nr4-auto-complete.png',
image: 'images/missing-modules.png',
description: {
"en-US": `<p>The <code>flow</code>/<code>global</code> context inputs and the <code>env</code> input
now all include auto-complete suggestions based on the live state of your flows.</p>
"en-US": `<p>Flows exported from Node-RED 4.1 now include information on what additional modules need to be installed.</p>
<p>When importing a flow with this information, the editor will let you know what is missing and help to get them installed.</p>
`,
"ja": `<p><code>flow</code>/<code>global</code>コンテキストや<code>env</code>の入力を、現在のフローの状態をもとに自動補完で提案するようになりました。</p>
"ja": `<p>Node-RED 4.1から書き出したフローには、インストールが必要な追加モジュールの情報が含まれる様になりました。</p>
<p>この情報を含むフローを読み込むと、エディタは不足しているモジュールを通知し、インストールを支援します。</p>
`,
"fr": `<p>Les entrées contextuelles <code>flow</code>/<code>global</code> et l'entrée <code>env</code>
incluent désormais des suggestions de saisie semi-automatique basées sur l'état actuel de vos flux.</p>
`,
}
},
{
title: {
"en-US": "Config node customisation in Subflows",
"ja": "サブフローでの設定ノードのカスタマイズ",
"fr": "Personnalisation du noeud de configuration dans les sous-flux"
},
image: 'images/nr4-sf-config.png',
description: {
"en-US": `<p>Subflows can now be customised to allow each instance to use a different
config node of a selected type.</p>
<p>For example, each instance of a subflow that connects to an MQTT Broker and does some post-processing
of the messages received can be pointed at a different broker.</p>
`,
"ja": `<p>サブフローをカスタマイズして、選択した型の異なる設定ノードを各インスタンスが使用できるようになりました。</p>
<p>例えば、MQTTブローカへ接続し、メッセージ受信と後処理を行うサブフローの各インスタンスに異なるブローカを指定することも可能です。</p>
`,
"fr": `<p>Les sous-flux peuvent désormais être personnalisés pour permettre à chaque instance d'utiliser un
noeud de configuration d'un type sélectionné.</p>
<p>Par exemple, chaque instance d'un sous-flux qui se connecte à un courtier MQTT et effectue un post-traitement
des messages reçus peut être pointée vers un autre courtier.</p>
"fr": `<p>Les flux exportés depuis Node-RED 4.1 incluent désormais des informations sur les modules supplémentaires à installer.</p>
<p>Lors de l'importation d'un flux contenant ces informations, l'éditeur vous indiquera les modules manquants et vous aidera à les installer.</p>
`
}
},
{
title: {
"en-US": "Remembering palette state",
"ja": "パレットの状態を維持",
"fr": "Mémorisation de l'état de la palette"
},
description: {
"en-US": `<p>The palette now remembers what categories you have hidden between reloads - as well as any
filter you have applied.</p>`,
"ja": `<p>パレット上で非表示にしたカテゴリや適用したフィルタが、リロードしても記憶されるようになりました。</p>`,
"fr": `<p>La palette se souvient désormais des catégories que vous avez masquées entre les rechargements,
ainsi que le filtre que vous avez appliqué.</p>`
}
},
{
title: {
"en-US": "Plugins shown in the Palette Manager",
"ja": "パレット管理にプラグインを表示",
"fr": "Affichage des Plugins dans le gestionnaire de palettes"
},
image: 'images/nr4-plugins.png',
description: {
"en-US": `<p>The palette manager now shows any plugin modules you have installed, such as
<code>node-red-debugger</code>. Previously they would only be shown if the plugins include
nodes for the palette.</p>`,
"ja": `<p>パレットの管理に <code>node-red-debugger</code> の様なインストールしたプラグインが表示されます。以前はプラグインにパレット向けのノードが含まれている時のみ表示されていました。</p>`,
"fr": `<p>Le gestionnaire de palettes affiche désormais tous les plugins que vous avez installés,
tels que <code>node-red-debugger</code>. Auparavant, ils n'étaient affichés que s'ils contenaient
des noeuds pour la palette.</p>`
}
},
{
title: {
"en-US": "Node Updates",
@@ -205,26 +100,26 @@ export default {
"en-US": `<p>The core nodes have received lots of minor fixes, documentation updates and
small enhancements. Check the full changelog in the Help sidebar for a full list.</p>
<ul>
<li>A fully RFC4180 compliant CSV mode</li>
<li>Customisable headers on the WebSocket node</li>
<li>Split node now can operate on any message property</li>
<li>Support for <code>node:</code> prefixed modules in the Function node</li>
<li>The ability to set a global timeout for Function nodes via the runtime settings</li>
<li>Better display of error objects in the Debug sidebar</li>
<li>and lots more...</li>
</ul>`,
"ja": `<p>コアノードには沢山の軽微な修正、ドキュメント更新、小さな機能拡張が入っています。全リストはヘルプサイドバーにある変更履歴を参照してください。</p>
<ul>
<li>RFC4180に完全に準拠したCSVモード</li>
<li>WebSocketードのカスタマイズ可能なヘッダ</li>
<li>Splitードは、メッセージプロパティで操作できるようになりました</li>
<li>他にも沢山あります...</li>
<li>Functionードで<code>node:</code>のプレフィックスモジュールをサポート</li>
<li>ランタイム設定からFunctionードのグローバルタイムアウトを設定可能</li>
<li>デバッグサイドバーでのエラーオブジェクトの表示を改善</li>
<li>その他、多数...</li>
</ul>`,
"fr": `<p>Les noeuds principaux ont reçu de nombreux correctifs mineurs ainsi que des améliorations. La documentation a été mise à jour.
Consultez le journal des modifications dans la barre latérale d'aide pour une liste complète. Ci-dessous, les changements les plus importants :</p>
<ul>
<li>Un mode CSV entièrement conforme à la norme RFC4180</li>
<li>En-têtes personnalisables pour le noeud WebSocket</li>
<li>Le noeud Split peut désormais fonctionner sur n'importe quelle propriété de message</li>
<li>Et bien plus encore...</li>
</ul>`
"fr": `<p>Les noeuds principaux ont bénéficié de nombreux correctifs mineurs, de mises à jour de documentation et d'améliorations mineures.
Consultez le journal complet des modifications dans la barre latérale d'aide pour une liste complète.</p>
<ul>
<li>Prise en charge des modules préfixés <code>node:</code> dans le noeud Fonction.</li>
<li>Possibilité de définir un délai d'expiration global pour les noeuds Fonction via les paramètres d'exécution.</li>
<li>Meilleur affichage des objets d'erreur dans la barre latérale de débogage.</li>
<li>Et bien plus encore...</li>
</ul>`
}
}
]

View File

@@ -2,11 +2,11 @@
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
/**
* The `assert` module provides a set of assertion functions for verifying
* The `node:assert` module provides a set of assertion functions for verifying
* invariants.
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/assert.js)
*/
declare module 'assert' {
declare module "assert" {
/**
* An alias of {@link ok}.
* @since v0.5.9
@@ -15,15 +15,29 @@ declare module 'assert' {
function assert(value: unknown, message?: string | Error): asserts value;
namespace assert {
/**
* Indicates the failure of an assertion. All errors thrown by the `assert` module
* will be instances of the `AssertionError` class.
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
*/
class AssertionError extends Error {
/**
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
*/
actual: unknown;
/**
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
*/
expected: unknown;
/**
* Set to the passed in operator value.
*/
operator: string;
/**
* Indicates if the message was auto-generated (`true`) or not.
*/
generatedMessage: boolean;
code: 'ERR_ASSERTION';
/**
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
*/
code: "ERR_ASSERTION";
constructor(options?: {
/** If provided, the error message is set to this value. */
message?: string | undefined;
@@ -34,14 +48,15 @@ declare module 'assert' {
/** The `operator` property on the error instance. */
operator?: string | undefined;
/** If provided, the generated stack trace omits frames before this function. */
// tslint:disable-next-line:ban-types
// eslint-disable-next-line @typescript-eslint/ban-types
stackStartFn?: Function | undefined;
});
}
/**
* This feature is currently experimental and behavior might still change.
* This feature is deprecated and will be removed in a future version.
* Please consider using alternatives such as the `mock` helper function.
* @since v14.2.0, v12.19.0
* @experimental
* @deprecated Deprecated
*/
class CallTracker {
/**
@@ -50,7 +65,7 @@ declare module 'assert' {
* error.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@@ -64,7 +79,7 @@ declare module 'assert' {
* @since v14.2.0, v12.19.0
* @param [fn='A no-op function']
* @param [exact=1]
* @return that wraps `fn`.
* @return A function that wraps `fn`.
*/
calls(exact?: number): () => void;
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
@@ -81,12 +96,10 @@ declare module 'assert' {
* callsfunc(1, 2, 3);
*
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
* [{ thisArg: this, arguments: [1, 2, 3 ] }]);
* [{ thisArg: undefined, arguments: [1, 2, 3] }]);
* ```
*
* @since v18.8.0, v16.18.0
* @params fn
* @returns An Array with the calls to a tracked function.
* @return An array with all the calls to a tracked function.
*/
getCalls(fn: Function): CallTrackerCall[];
/**
@@ -94,21 +107,19 @@ declare module 'assert' {
* the functions that have not been called the expected number of times.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
*
* function func() {}
*
* function foo() {}
*
* // Returns a function that wraps func() that must be called exact times
* // before tracker.verify().
* const callsfunc = tracker.calls(func, 2);
*
* // Returns an array containing information on callsfunc()
* tracker.report();
* console.log(tracker.report());
* // [
* // {
* // message: 'Expected the func function to be executed 2 time(s) but was
@@ -121,12 +132,11 @@ declare module 'assert' {
* // ]
* ```
* @since v14.2.0, v12.19.0
* @return of objects containing information about the wrapper functions returned by `calls`.
* @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
*/
report(): CallTrackerReportInformation[];
/**
* Reset calls of the call tracker.
* If a tracked function is passed as an argument, the calls will be reset for it.
* Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
* If no arguments are passed, all tracked functions will be reset.
*
* ```js
@@ -139,22 +149,21 @@ declare module 'assert' {
*
* callsfunc();
* // Tracker was called once
* tracker.getCalls(callsfunc).length === 1;
* assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
*
* tracker.reset(callsfunc);
* tracker.getCalls(callsfunc).length === 0;
* assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
* ```
*
* @since v18.8.0, v16.18.0
* @param fn a tracked function to reset.
*/
reset(fn?: Function): void;
/**
* Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
* Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
* have not been called the expected number of times.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@@ -189,14 +198,14 @@ declare module 'assert' {
/** A stack trace of the function. */
stack: object;
}
type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
/**
* Throws an `AssertionError` with the provided error message or a default
* error message. If the `message` parameter is an instance of an `Error` then
* it will be thrown instead of the `AssertionError`.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.fail();
* // AssertionError [ERR_ASSERTION]: Failed
@@ -220,21 +229,21 @@ declare module 'assert' {
expected: unknown,
message?: string | Error,
operator?: string,
// tslint:disable-next-line:ban-types
stackStartFn?: Function
// eslint-disable-next-line @typescript-eslint/ban-types
stackStartFn?: Function,
): never;
/**
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
* If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
* If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
*
* Be aware that in the `repl` the error message will be different to the one
* thrown in a file! See below for further details.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.ok(true);
* // OK
@@ -269,7 +278,7 @@ declare module 'assert' {
* ```
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* // Using `assert()` works the same:
* assert(0);
@@ -294,7 +303,7 @@ declare module 'assert' {
* and treated as being identical if both sides are `NaN`.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*
* assert.equal(1, 1);
* // OK, 1 == 1
@@ -309,8 +318,8 @@ declare module 'assert' {
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
* ```
*
* If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
* If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
* @since v0.1.21
*/
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
@@ -327,7 +336,7 @@ declare module 'assert' {
* specially handled and treated as being identical if both sides are `NaN`.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*
* assert.notEqual(1, 2);
* // OK
@@ -339,8 +348,8 @@ declare module 'assert' {
* // AssertionError: 1 != '1'
* ```
*
* If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
* message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
* If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
* message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
* @since v0.1.21
*/
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
@@ -374,24 +383,24 @@ declare module 'assert' {
* Tests for any deep inequality. Opposite of {@link deepEqual}.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*
* const obj1 = {
* a: {
* b: 1
* }
* b: 1,
* },
* };
* const obj2 = {
* a: {
* b: 2
* }
* b: 2,
* },
* };
* const obj3 = {
* a: {
* b: 1
* }
* b: 1,
* },
* };
* const obj4 = Object.create(obj1);
* const obj4 = { __proto__: obj1 };
*
* assert.notDeepEqual(obj1, obj1);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
@@ -406,8 +415,8 @@ declare module 'assert' {
* // OK
* ```
*
* If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
* error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
* If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
* instead of the `AssertionError`.
* @since v0.1.21
*/
@@ -417,7 +426,7 @@ declare module 'assert' {
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.strictEqual(1, 2);
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
@@ -444,8 +453,8 @@ declare module 'assert' {
* // TypeError: Inputs are not identical
* ```
*
* If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
* If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
* instead of the `AssertionError`.
* @since v0.1.21
*/
@@ -455,7 +464,7 @@ declare module 'assert' {
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.notStrictEqual(1, 2);
* // OK
@@ -469,8 +478,8 @@ declare module 'assert' {
* // OK
* ```
*
* If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
* If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
* instead of the `AssertionError`.
* @since v0.1.21
*/
@@ -486,7 +495,7 @@ declare module 'assert' {
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
* // OK
@@ -511,20 +520,20 @@ declare module 'assert' {
* using an object, it is also possible to use a regular expression, when
* validating against a string property. See below for examples.
*
* If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
* If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
* fails.
*
* Custom validation object/error instance:
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* const err = new TypeError('Wrong value');
* err.code = 404;
* err.foo = 'bar';
* err.info = {
* nested: true,
* baz: 'text'
* baz: 'text',
* };
* err.reg = /abc/i;
*
@@ -537,16 +546,16 @@ declare module 'assert' {
* message: 'Wrong value',
* info: {
* nested: true,
* baz: 'text'
* }
* baz: 'text',
* },
* // Only properties on the validation object will be tested for.
* // Using nested objects requires all properties to be present. Otherwise
* // the validation is going to fail.
* }
* },
* );
*
* // Using regular expressions to validate error properties:
* throws(
* assert.throws(
* () => {
* throw err;
* },
@@ -560,17 +569,17 @@ declare module 'assert' {
* info: {
* nested: true,
* // It is not possible to use regular expressions for nested properties!
* baz: 'text'
* baz: 'text',
* },
* // The `reg` property contains a regular expression and only if the
* // validation object contains an identical regular expression, it is going
* // to pass.
* reg: /abc/i
* }
* reg: /abc/i,
* },
* );
*
* // Fails due to the different `message` and `name` properties:
* throws(
* assert.throws(
* () => {
* const otherErr = new Error('Not found');
* // Copy all enumerable properties from `err` to `otherErr`.
@@ -581,20 +590,20 @@ declare module 'assert' {
* },
* // The error's `message` and `name` properties will also be checked when using
* // an error as validation object.
* err
* err,
* );
* ```
*
* Validate instanceof using constructor:
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
* Error
* Error,
* );
* ```
*
@@ -604,13 +613,13 @@ declare module 'assert' {
* therefore also include the error name.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
* /^Error: Wrong value$/
* /^Error: Wrong value$/,
* );
* ```
*
@@ -620,7 +629,7 @@ declare module 'assert' {
* It will otherwise fail with an `AssertionError`.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.throws(
* () => {
@@ -636,17 +645,17 @@ declare module 'assert' {
* // possible.
* return true;
* },
* 'unexpected error'
* 'unexpected error',
* );
* ```
*
* `error` cannot be a string. If a string is provided as the second
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
* message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
* argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
* message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
* a string as the second argument gets considered:
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* function throwingFirst() {
* throw new Error('First');
@@ -695,27 +704,27 @@ declare module 'assert' {
* adding a comment next to the specific code path that should not throw and keep
* error messages as expressive as possible.
*
* When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
* When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
*
* If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
* If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
* different type, or if the `error` parameter is undefined, the error is
* propagated back to the caller.
*
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
* function. See {@link throws} for more details.
*
* The following, for instance, will throw the `TypeError` because there is no
* matching error type in the assertion:
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* SyntaxError
* SyntaxError,
* );
* ```
*
@@ -723,27 +732,27 @@ declare module 'assert' {
* 'Got unwanted exception...':
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* TypeError
* TypeError,
* );
* ```
*
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
* If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message:
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* /Wrong value/,
* 'Whoops'
* 'Whoops',
* );
* // Throws: AssertionError: Got unwanted exception: Whoops
* ```
@@ -754,10 +763,10 @@ declare module 'assert' {
/**
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
* testing the `error` argument in callbacks. The stack trace contains all frames
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
* from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.ifError(null);
* // OK
@@ -789,21 +798,21 @@ declare module 'assert' {
* calls the function and awaits the returned promise to complete. It will then
* check that the promise is rejected.
*
* If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
* function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
* handler is skipped.
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value)
* error. In both cases the error handler is skipped.
*
* Besides the async nature to await the completion behaves identically to {@link throws}.
*
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
* an object where each property will be tested for, or an instance of error where
* each property will be tested for including the non-enumerable `message` and`name` properties.
* each property will be tested for including the non-enumerable `message` and `name` properties.
*
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
* If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* await assert.rejects(
* async () => {
@@ -811,13 +820,13 @@ declare module 'assert' {
* },
* {
* name: 'TypeError',
* message: 'Wrong value'
* }
* message: 'Wrong value',
* },
* );
* ```
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* await assert.rejects(
* async () => {
@@ -827,37 +836,40 @@ declare module 'assert' {
* assert.strictEqual(err.name, 'TypeError');
* assert.strictEqual(err.message, 'Wrong value');
* return true;
* }
* },
* );
* ```
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.rejects(
* Promise.reject(new Error('Wrong value')),
* Error
* Error,
* ).then(() => {
* // ...
* });
* ```
*
* `error` cannot be a string. If a string is provided as the second
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
* example in {@link throws} carefully if using a string as the second
* argument gets considered.
* `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
* be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
* example in {@link throws} carefully if using a string as the second argument gets considered.
* @since v10.0.0
*/
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
function rejects(
block: (() => Promise<unknown>) | Promise<unknown>,
error: AssertPredicate,
message?: string | Error,
): Promise<void>;
/**
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
* calls the function and awaits the returned promise to complete. It will then
* check that the promise is not rejected.
*
* If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
* the function does not return a promise, `assert.doesNotReject()` will return a
* rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value) error. In both cases
* the error handler is skipped.
*
* Using `assert.doesNotReject()` is actually not useful because there is little
@@ -866,24 +878,24 @@ declare module 'assert' {
* error messages as expressive as possible.
*
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
* function. See {@link throws} for more details.
*
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* await assert.doesNotReject(
* async () => {
* throw new TypeError('Wrong value');
* },
* SyntaxError
* SyntaxError,
* );
* ```
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
* .then(() => {
@@ -892,13 +904,20 @@ declare module 'assert' {
* ```
* @since v10.0.0
*/
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
function doesNotReject(
block: (() => Promise<unknown>) | Promise<unknown>,
message?: string | Error,
): Promise<void>;
function doesNotReject(
block: (() => Promise<unknown>) | Promise<unknown>,
error: AssertPredicate,
message?: string | Error,
): Promise<void>;
/**
* Expects the `string` input to match the regular expression.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.match('I will fail', /pass/);
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
@@ -910,10 +929,10 @@ declare module 'assert' {
* // OK
* ```
*
* If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
* to the value of the `message` parameter. If the `message` parameter is
* undefined, a default error message is assigned. If the `message` parameter is an
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
* instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* @since v13.6.0, v12.16.0
*/
function match(value: string, regExp: RegExp, message?: string | Error): void;
@@ -921,7 +940,7 @@ declare module 'assert' {
* Expects the `string` input not to match the regular expression.
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.doesNotMatch('I will fail', /fail/);
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
@@ -933,32 +952,92 @@ declare module 'assert' {
* // OK
* ```
*
* If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
* to the value of the `message` parameter. If the `message` parameter is
* undefined, a default error message is assigned. If the `message` parameter is an
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
* instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* @since v13.6.0, v12.16.0
*/
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
const strict: Omit<typeof assert, 'equal' | 'notEqual' | 'deepEqual' | 'notDeepEqual' | 'ok' | 'strictEqual' | 'deepStrictEqual' | 'ifError' | 'strict'> & {
(value: unknown, message?: string | Error): asserts value;
equal: typeof strictEqual;
notEqual: typeof notStrictEqual;
deepEqual: typeof deepStrictEqual;
notDeepEqual: typeof notDeepStrictEqual;
// Mapped types and assertion functions are incompatible?
// TS2775: Assertions require every name in the call target
// to be declared with an explicit type annotation.
ok: typeof ok;
strictEqual: typeof strictEqual;
deepStrictEqual: typeof deepStrictEqual;
ifError: typeof ifError;
strict: typeof strict;
};
/**
* In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
* {@link deepEqual} will behave like {@link deepStrictEqual}.
*
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
* messages for objects display the objects, often truncated.
*
* To use strict assertion mode:
*
* ```js
* import { strict as assert } from 'node:assert';COPY
* import assert from 'node:assert/strict';
* ```
*
* Example error diff:
*
* ```js
* import { strict as assert } from 'node:assert';
*
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
* // AssertionError: Expected inputs to be strictly deep-equal:
* // + actual - expected ... Lines skipped
* //
* // [
* // [
* // ...
* // 2,
* // + 3
* // - '3'
* // ],
* // ...
* // 5
* // ]
* ```
*
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
* `getColorDepth()` documentation.
*
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
*/
namespace strict {
type AssertionError = assert.AssertionError;
type AssertPredicate = assert.AssertPredicate;
type CallTrackerCall = assert.CallTrackerCall;
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
}
const strict:
& Omit<
typeof assert,
| "equal"
| "notEqual"
| "deepEqual"
| "notDeepEqual"
| "ok"
| "strictEqual"
| "deepStrictEqual"
| "ifError"
| "strict"
>
& {
(value: unknown, message?: string | Error): asserts value;
equal: typeof strictEqual;
notEqual: typeof notStrictEqual;
deepEqual: typeof deepStrictEqual;
notDeepEqual: typeof notDeepStrictEqual;
// Mapped types and assertion functions are incompatible?
// TS2775: Assertions require every name in the call target
// to be declared with an explicit type annotation.
ok: typeof ok;
strictEqual: typeof strictEqual;
deepStrictEqual: typeof deepStrictEqual;
ifError: typeof ifError;
strict: typeof strict;
};
}
export = assert;
}
declare module 'node:assert' {
import assert = require('assert');
declare module "node:assert" {
import assert = require("assert");
export = assert;
}

View File

@@ -1,11 +1,11 @@
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
declare module 'assert/strict' {
import { strict } from 'node:assert';
declare module "assert/strict" {
import { strict } from "node:assert";
export = strict;
}
declare module 'node:assert/strict' {
import { strict } from 'node:assert';
declare module "node:assert/strict" {
import { strict } from "node:assert";
export = strict;
}

View File

@@ -2,21 +2,29 @@
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
/**
* The `async_hooks` module provides an API to track asynchronous resources. It
* can be accessed using:
* We strongly discourage the use of the `async_hooks` API.
* Other APIs that can cover most of its use cases include:
*
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v20.x/api/async_context.html#class-asynclocalstorage) tracks async context
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
*
* The `node:async_hooks` module provides an API to track asynchronous resources.
* It can be accessed using:
*
* ```js
* import async_hooks from 'async_hooks';
* import async_hooks from 'node:async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/async_hooks.js)
*/
declare module 'async_hooks' {
declare module "async_hooks" {
/**
* ```js
* import { executionAsyncId } from 'async_hooks';
* import { executionAsyncId } from 'node:async_hooks';
* import fs from 'node:fs';
*
* console.log(executionAsyncId()); // 1 - bootstrap
* const path = '.';
* fs.open(path, 'r', (err, fd) => {
* console.log(executionAsyncId()); // 6 - open()
* });
@@ -39,7 +47,7 @@ declare module 'async_hooks' {
* ```
*
* Promise contexts may not get precise `executionAsyncIds` by default.
* See the section on `promise execution tracking`.
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
* @since v8.1.0
* @return The `asyncId` of the current execution context. Useful to track when something calls.
*/
@@ -54,8 +62,8 @@ declare module 'async_hooks' {
* but having an object representing the top-level can be helpful.
*
* ```js
* import { open } from 'fs';
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
* import { open } from 'node:fs';
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
*
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
* open(new URL(import.meta.url), 'r', (err, fd) => {
@@ -67,11 +75,11 @@ declare module 'async_hooks' {
* use of a tracking `Map` to store the metadata:
*
* ```js
* import { createServer } from 'http';
* import { createServer } from 'node:http';
* import {
* executionAsyncId,
* executionAsyncResource,
* createHook
* createHook,
* } from 'async_hooks';
* const sym = Symbol('state'); // Private symbol to avoid pollution
*
@@ -81,7 +89,7 @@ declare module 'async_hooks' {
* if (cr) {
* resource[sym] = cr[sym];
* }
* }
* },
* }).enable();
*
* const server = createServer((req, res) => {
@@ -112,17 +120,17 @@ declare module 'async_hooks' {
* ```
*
* Promise contexts may not get valid `triggerAsyncId`s by default. See
* the section on `promise execution tracking`.
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
* @return The ID of the resource responsible for calling the callback that is currently being executed.
*/
function triggerAsyncId(): number;
interface HookCallbacks {
/**
* Called when a class is constructed that has the possibility to emit an asynchronous event.
* @param asyncId a unique ID for the async resource
* @param type the type of the async resource
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
* @param resource reference to the resource representing the async operation, needs to be released during destroy
* @param asyncId A unique ID for the async resource
* @param type The type of the async resource
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
*/
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
/**
@@ -132,7 +140,9 @@ declare module 'async_hooks' {
*/
before?(asyncId: number): void;
/**
* Called immediately after the callback specified in before is completed.
* Called immediately after the callback specified in `before` is completed.
*
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
*/
after?(asyncId: number): void;
@@ -170,11 +180,11 @@ declare module 'async_hooks' {
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
*
* ```js
* import { createHook } from 'async_hooks';
* import { createHook } from 'node:async_hooks';
*
* const asyncHook = createHook({
* init(asyncId, type, triggerAsyncId, resource) { },
* destroy(asyncId) { }
* destroy(asyncId) { },
* });
* ```
*
@@ -226,13 +236,13 @@ declare module 'async_hooks' {
* The following is an overview of the `AsyncResource` API.
*
* ```js
* import { AsyncResource, executionAsyncId } from 'async_hooks';
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
*
* // AsyncResource() is meant to be extended. Instantiating a
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
* // async_hook.executionAsyncId() is used.
* const asyncResource = new AsyncResource(
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
* );
*
* // Run a function in the execution context of the resource. This will
@@ -266,9 +276,6 @@ declare module 'async_hooks' {
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
/**
* Binds the given function to the current execution context.
*
* The returned function will have an `asyncResource` property referencing
* the `AsyncResource` to which the function is bound.
* @since v14.8.0, v12.19.0
* @param fn The function to bind to the current execution context.
* @param type An optional name to associate with the underlying `AsyncResource`.
@@ -276,23 +283,14 @@ declare module 'async_hooks' {
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
fn: Func,
type?: string,
thisArg?: ThisArg
): Func & {
asyncResource: AsyncResource;
};
thisArg?: ThisArg,
): Func;
/**
* Binds the given function to execute to this `AsyncResource`'s scope.
*
* The returned function will have an `asyncResource` property referencing
* the `AsyncResource` to which the function is bound.
* @since v14.8.0, v12.19.0
* @param fn The function to bind to the current `AsyncResource`.
*/
bind<Func extends (...args: any[]) => any>(
fn: Func
): Func & {
asyncResource: AsyncResource;
};
bind<Func extends (...args: any[]) => any>(fn: Func): Func;
/**
* Call the provided function with the provided arguments in the execution context
* of the async resource. This will establish the context, trigger the AsyncHooks
@@ -303,7 +301,11 @@ declare module 'async_hooks' {
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
runInAsyncScope<This, Result>(
fn: (this: This, ...args: any[]) => Result,
thisArg?: This,
...args: any[]
): Result;
/**
* Call all `destroy` hooks. This should only ever be called once. An error will
* be thrown if it is called more than once. This **must** be manually called. If
@@ -317,7 +319,6 @@ declare module 'async_hooks' {
*/
asyncId(): number;
/**
*
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
*/
triggerAsyncId(): number;
@@ -325,17 +326,17 @@ declare module 'async_hooks' {
/**
* This class creates stores that stay coherent through asynchronous operations.
*
* While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
* implementation that involves significant optimizations that are non-obvious to
* implement.
* While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
* safe implementation that involves significant optimizations that are non-obvious
* to implement.
*
* The following example uses `AsyncLocalStorage` to build a simple logger
* that assigns IDs to incoming HTTP requests and includes them in messages
* logged within each request.
*
* ```js
* import http from 'http';
* import { AsyncLocalStorage } from 'async_hooks';
* import http from 'node:http';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
@@ -371,14 +372,52 @@ declare module 'async_hooks' {
* @since v13.10.0, v12.17.0
*/
class AsyncLocalStorage<T> {
/**
* Binds the given function to the current execution context.
* @since v19.8.0
* @experimental
* @param fn The function to bind to the current execution context.
* @return A new function that calls `fn` within the captured execution context.
*/
static bind<Func extends (...args: any[]) => any>(fn: Func): Func;
/**
* Captures the current execution context and returns a function that accepts a
* function as an argument. Whenever the returned function is called, it
* calls the function passed to it within the captured context.
*
* ```js
* const asyncLocalStorage = new AsyncLocalStorage();
* const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot());
* const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
* console.log(result); // returns 123
* ```
*
* AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple
* async context tracking purposes, for example:
*
* ```js
* class Foo {
* #runInAsyncScope = AsyncLocalStorage.snapshot();
*
* get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); }
* }
*
* const foo = asyncLocalStorage.run(123, () => new Foo());
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
* ```
* @since v19.8.0
* @experimental
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
*/
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
/**
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
* to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
*
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
* instance will be exited.
*
* Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
* Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
* provided by the `asyncLocalStorage`, as those objects are garbage collected
* along with the corresponding async resources.
*
@@ -426,11 +465,12 @@ declare module 'async_hooks' {
* ```
* @since v13.10.0, v12.17.0
*/
run<R>(store: T, callback: () => R): R;
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
/**
* Runs a function synchronously outside of a context and returns its
* return value. The store is not accessible within the callback function or
* the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
* the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
*
* The optional `args` are passed to the callback function.
*
@@ -476,7 +516,7 @@ declare module 'async_hooks' {
* This transition will continue for the _entire_ synchronous execution.
* This means that if, for example, the context is entered within an event
* handler subsequent event handlers will also run within that context unless
* specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
* specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
* to use the latter method.
*
* ```js
@@ -499,6 +539,6 @@ declare module 'async_hooks' {
enterWith(store: T): void;
}
}
declare module 'node:async_hooks' {
export * from 'async_hooks';
declare module "node:async_hooks" {
export * from "async_hooks";
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,20 +3,20 @@
/**
* Clusters of Node.js processes can be used to run multiple instances of Node.js
* that can distribute workloads among their application threads. When process
* isolation is not needed, use the `worker_threads` module instead, which
* allows running multiple application threads within a single Node.js instance.
* that can distribute workloads among their application threads. When process isolation
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html)
* module instead, which allows running multiple application threads within a single Node.js instance.
*
* The cluster module allows easy creation of child processes that all share
* server ports.
*
* ```js
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
*
* const numCPUs = cpus().length;
* const numCPUs = availableParallelism();
*
* if (cluster.isPrimary) {
* console.log(`Primary ${process.pid} is running`);
@@ -53,26 +53,82 @@
* ```
*
* On Windows, it is not yet possible to set up a named pipe server in a worker.
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/cluster.js)
*/
declare module 'cluster' {
import * as child from 'node:child_process';
import EventEmitter = require('node:events');
import * as net from 'node:net';
declare module "cluster" {
import * as child from "node:child_process";
import EventEmitter = require("node:events");
import * as net from "node:net";
type SerializationType = "json" | "advanced";
export interface ClusterSettings {
execArgv?: string[] | undefined; // default: process.execArgv
/**
* List of string arguments passed to the Node.js executable.
* @default process.execArgv
*/
execArgv?: string[] | undefined;
/**
* File path to worker file.
* @default process.argv[1]
*/
exec?: string | undefined;
/**
* String arguments passed to worker.
* @default process.argv.slice(2)
*/
args?: string[] | undefined;
/**
* Whether or not to send output to parent's stdio.
* @default false
*/
silent?: boolean | undefined;
/**
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processspawncommand-args-options)'s
* [`stdio`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#optionsstdio).
*/
stdio?: any[] | undefined;
/**
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
*/
uid?: number | undefined;
/**
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
*/
gid?: number | undefined;
/**
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
*/
inspectPort?: number | (() => number) | undefined;
/**
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#advanced-serialization) for more details.
* @default false
*/
serialization?: SerializationType | undefined;
/**
* Current working directory of the worker process.
* @default undefined (inherits from parent process)
*/
cwd?: string | undefined;
/**
* Hide the forked processes console window that would normally be created on Windows systems.
* @default false
*/
windowsHide?: boolean | undefined;
}
export interface Address {
address: string;
port: number;
addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
/**
* The `addressType` is one of:
*
* * `4` (TCPv4)
* * `6` (TCPv6)
* * `-1` (Unix domain socket)
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
*/
addressType: 4 | 6 | -1 | "udp4" | "udp6";
}
/**
* A `Worker` object contains all public information and method about a worker.
@@ -82,17 +138,17 @@ declare module 'cluster' {
*/
export class Worker extends EventEmitter {
/**
* Each new worker is given its own unique id, this id is stored in the`id`.
* Each new worker is given its own unique id, this id is stored in the `id`.
*
* While a worker is alive, this is the key that indexes it in`cluster.workers`.
* While a worker is alive, this is the key that indexes it in `cluster.workers`.
* @since v0.8.0
*/
id: number;
/**
* All workers are created using `child_process.fork()`, the returned object
* from this function is stored as `.process`. In a worker, the global `process`is stored.
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
* from this function is stored as `.process`. In a worker, the global `process` is stored.
*
* See: `Child Process module`.
* See: [Child Process module](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processforkmodulepath-args-options).
*
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
@@ -103,9 +159,9 @@ declare module 'cluster' {
/**
* Send a message to a worker or primary, optionally with a handle.
*
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
*
* In a worker, this sends a message to the primary. It is identical to`process.send()`.
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
*
* This example will echo back all messages from the primary:
*
@@ -121,14 +177,23 @@ declare module 'cluster' {
* }
* ```
* @since v0.7.0
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
*/
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
send(
message: child.Serializable,
sendHandle: child.SendHandle,
callback?: (error: Error | null) => void,
): boolean;
send(
message: child.Serializable,
sendHandle: child.SendHandle,
options?: child.MessageOptions,
callback?: (error: Error | null) => void,
): boolean;
/**
* This function will kill the worker. In the primary worker, it does this by
* disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
* disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`.
*
* The `kill()` function kills the worker process without waiting for a graceful
* disconnect, it has the same behavior as `worker.process.kill()`.
@@ -136,7 +201,7 @@ declare module 'cluster' {
* This method is aliased as `worker.destroy()` for backwards compatibility.
*
* In a worker, `process.kill()` exists, but it is not this function;
* it is `kill()`.
* it is [`kill()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processkillpid-signal).
* @since v0.9.12
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
*/
@@ -146,7 +211,7 @@ declare module 'cluster' {
* In a worker, this function will close all servers, wait for the `'close'` event
* on those servers, and then disconnect the IPC channel.
*
* In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
* In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
*
* Causes `.exitedAfterDisconnect` to be set.
*
@@ -186,7 +251,7 @@ declare module 'cluster' {
* });
*
* } else if (cluster.isWorker) {
* const net = require('net');
* const net = require('node:net');
* const server = net.createServer((socket) => {
* // Connections never end
* });
@@ -216,12 +281,12 @@ declare module 'cluster' {
* because of exiting or being signaled). Otherwise, it returns `false`.
*
* ```js
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
*
* const numCPUs = cpus().length;
* const numCPUs = availableParallelism();
*
* if (cluster.isPrimary) {
* console.log(`Primary ${process.pid} is running`);
@@ -282,64 +347,158 @@ declare module 'cluster' {
* 6. online
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: 'disconnect', listener: () => void): this;
addListener(event: 'error', listener: (error: Error) => void): this;
addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
addListener(event: 'listening', listener: (address: Address) => void): this;
addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: 'online', listener: () => void): this;
addListener(event: "disconnect", listener: () => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
addListener(event: "listening", listener: (address: Address) => void): this;
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: 'disconnect'): boolean;
emit(event: 'error', error: Error): boolean;
emit(event: 'exit', code: number, signal: string): boolean;
emit(event: 'listening', address: Address): boolean;
emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
emit(event: 'online'): boolean;
emit(event: "disconnect"): boolean;
emit(event: "error", error: Error): boolean;
emit(event: "exit", code: number, signal: string): boolean;
emit(event: "listening", address: Address): boolean;
emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
emit(event: "online"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: 'disconnect', listener: () => void): this;
on(event: 'error', listener: (error: Error) => void): this;
on(event: 'exit', listener: (code: number, signal: string) => void): this;
on(event: 'listening', listener: (address: Address) => void): this;
on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
on(event: 'online', listener: () => void): this;
on(event: "disconnect", listener: () => void): this;
on(event: "error", listener: (error: Error) => void): this;
on(event: "exit", listener: (code: number, signal: string) => void): this;
on(event: "listening", listener: (address: Address) => void): this;
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
on(event: "online", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: 'disconnect', listener: () => void): this;
once(event: 'error', listener: (error: Error) => void): this;
once(event: 'exit', listener: (code: number, signal: string) => void): this;
once(event: 'listening', listener: (address: Address) => void): this;
once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
once(event: 'online', listener: () => void): this;
once(event: "disconnect", listener: () => void): this;
once(event: "error", listener: (error: Error) => void): this;
once(event: "exit", listener: (code: number, signal: string) => void): this;
once(event: "listening", listener: (address: Address) => void): this;
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
once(event: "online", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: 'disconnect', listener: () => void): this;
prependListener(event: 'error', listener: (error: Error) => void): this;
prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
prependListener(event: 'listening', listener: (address: Address) => void): this;
prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
prependListener(event: 'online', listener: () => void): this;
prependListener(event: "disconnect", listener: () => void): this;
prependListener(event: "error", listener: (error: Error) => void): this;
prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
prependListener(event: "listening", listener: (address: Address) => void): this;
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
prependListener(event: "online", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'disconnect', listener: () => void): this;
prependOnceListener(event: 'error', listener: (error: Error) => void): this;
prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
prependOnceListener(event: 'online', listener: () => void): this;
prependOnceListener(event: "disconnect", listener: () => void): this;
prependOnceListener(event: "error", listener: (error: Error) => void): this;
prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
prependOnceListener(event: "listening", listener: (address: Address) => void): this;
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
prependOnceListener(event: "online", listener: () => void): this;
}
export interface Cluster extends EventEmitter {
disconnect(callback?: () => void): void;
/**
* Spawn a new worker process.
*
* This can only be called from the primary process.
* @param env Key/value pairs to add to worker process environment.
* @since v0.6.0
*/
fork(env?: any): Worker;
/** @deprecated since v16.0.0 - use isPrimary. */
readonly isMaster: boolean;
/**
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
* is undefined, then `isPrimary` is `true`.
* @since v16.0.0
*/
readonly isPrimary: boolean;
/**
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
* @since v0.6.0
*/
readonly isWorker: boolean;
/**
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings)
* is called, whichever comes first.
*
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
* IOCP handles without incurring a large performance hit.
*
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
* @since v0.11.2
*/
schedulingPolicy: number;
/**
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings)
* (or [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv)) this settings object will contain
* the settings, including the default values.
*
* This object is not intended to be changed or set manually.
* @since v0.7.1
*/
readonly settings: ClusterSettings;
/** @deprecated since v16.0.0 - use setupPrimary. */
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings) instead. */
setupMaster(settings?: ClusterSettings): void;
/**
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
*
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv)
* and have no effect on workers that are already running.
*
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
* [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv).
*
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
* `cluster.setupPrimary()` is called.
*
* ```js
* import cluster from 'node:cluster';
*
* cluster.setupPrimary({
* exec: 'worker.js',
* args: ['--use', 'https'],
* silent: true,
* });
* cluster.fork(); // https worker
* cluster.setupPrimary({
* exec: 'worker.js',
* args: ['--use', 'http'],
* });
* cluster.fork(); // http worker
* ```
*
* This can only be called from the primary process.
* @since v16.0.0
*/
setupPrimary(settings?: ClusterSettings): void;
/**
* A reference to the current worker object. Not available in the primary process.
*
* ```js
* import cluster from 'node:cluster';
*
* if (cluster.isPrimary) {
* console.log('I am primary');
* cluster.fork();
* cluster.fork();
* } else if (cluster.isWorker) {
* console.log(`I am worker #${cluster.worker.id}`);
* }
* ```
* @since v0.7.0
*/
readonly worker?: Worker | undefined;
/**
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
*
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
*
* ```js
* import cluster from 'node:cluster';
*
* for (const worker of Object.values(cluster.workers)) {
* worker.send('big announcement to all workers');
* }
* ```
* @since v0.7.0
*/
readonly workers?: NodeJS.Dict<Worker> | undefined;
readonly SCHED_NONE: number;
readonly SCHED_RR: number;
@@ -354,60 +513,69 @@ declare module 'cluster' {
* 7. setup
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
addListener(event: 'fork', listener: (worker: Worker) => void): this;
addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: 'online', listener: (worker: Worker) => void): this;
addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
addListener(event: "fork", listener: (worker: Worker) => void): this;
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
addListener(
event: "message",
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: (worker: Worker) => void): this;
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: 'disconnect', worker: Worker): boolean;
emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
emit(event: 'fork', worker: Worker): boolean;
emit(event: 'listening', worker: Worker, address: Address): boolean;
emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
emit(event: 'online', worker: Worker): boolean;
emit(event: 'setup', settings: ClusterSettings): boolean;
emit(event: "disconnect", worker: Worker): boolean;
emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
emit(event: "fork", worker: Worker): boolean;
emit(event: "listening", worker: Worker, address: Address): boolean;
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
emit(event: "online", worker: Worker): boolean;
emit(event: "setup", settings: ClusterSettings): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: 'disconnect', listener: (worker: Worker) => void): this;
on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
on(event: 'fork', listener: (worker: Worker) => void): this;
on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
on(event: 'online', listener: (worker: Worker) => void): this;
on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
on(event: "disconnect", listener: (worker: Worker) => void): this;
on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
on(event: "fork", listener: (worker: Worker) => void): this;
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
on(event: "online", listener: (worker: Worker) => void): this;
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: 'disconnect', listener: (worker: Worker) => void): this;
once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
once(event: 'fork', listener: (worker: Worker) => void): this;
once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
once(event: 'online', listener: (worker: Worker) => void): this;
once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
once(event: "disconnect", listener: (worker: Worker) => void): this;
once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
once(event: "fork", listener: (worker: Worker) => void): this;
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
once(event: "online", listener: (worker: Worker) => void): this;
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
prependListener(event: 'fork', listener: (worker: Worker) => void): this;
prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
prependListener(event: "fork", listener: (worker: Worker) => void): this;
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
// the handle is a net.Socket or net.Server object, or undefined.
prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
prependListener(event: 'online', listener: (worker: Worker) => void): this;
prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
prependListener(
event: "message",
listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
): this;
prependListener(event: "online", listener: (worker: Worker) => void): this;
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
// the handle is a net.Socket or net.Server object, or undefined.
prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
prependOnceListener(
event: "message",
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
): this;
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
}
const cluster: Cluster;
export default cluster;
}
declare module 'node:cluster' {
export * from 'cluster';
export { default as default } from 'cluster';
declare module "node:cluster" {
export * from "cluster";
export { default as default } from "cluster";
}

View File

@@ -2,17 +2,18 @@
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
/**
* The `console` module provides a simple debugging console that is similar to the
* JavaScript console mechanism provided by web browsers.
* The `node:console` module provides a simple debugging console that is similar to
* the JavaScript console mechanism provided by web browsers.
*
* The module exports two specific components:
*
* * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without calling `require('node:console')`.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
* asynchronous like all other Node.js streams. See the `note on process I/O` for
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v20.x/api/process.html#a-note-on-process-io) for
* more information.
*
* Example using the global `console`:
@@ -56,14 +57,14 @@
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/console.js)
*/
declare module 'console' {
import console = require('node:console');
declare module "console" {
import console = require("node:console");
export = console;
}
declare module 'node:console' {
import { InspectOptions } from 'node:util';
declare module "node:console" {
import { InspectOptions } from "node:util";
global {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
interface Console {
@@ -71,7 +72,8 @@ declare module 'node:console' {
/**
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
* writes a message and does not otherwise affect execution. The output always
* starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`.
* starts with `"Assertion failed"`. If provided, `message` is formatted using
* [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args).
*
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
*
@@ -94,7 +96,7 @@ declare module 'node:console' {
* TTY. When `stdout` is not a TTY, this method does nothing.
*
* The specific operation of `console.clear()` can vary across operating systems
* and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the
* and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the
* current terminal viewport for the Node.js
* binary.
* @since v8.3.0
@@ -126,7 +128,7 @@ declare module 'node:console' {
* >
* ```
* @since v8.3.0
* @param label The display label for the counter.
* @param [label='default'] The display label for the counter.
*/
count(label?: string): void;
/**
@@ -144,7 +146,7 @@ declare module 'node:console' {
* >
* ```
* @since v8.3.0
* @param label The display label for the counter.
* @param [label='default'] The display label for the counter.
*/
countReset(label?: string): void;
/**
@@ -153,7 +155,7 @@ declare module 'node:console' {
*/
debug(message?: any, ...optionalParams: any[]): void;
/**
* Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`.
* Uses [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`.
* This function bypasses any custom `inspect()` function defined on `obj`.
* @since v0.1.101
*/
@@ -167,7 +169,8 @@ declare module 'node:console' {
/**
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
* first used as the primary message and all additional used as substitution
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)).
*
* ```js
* const code = 5;
@@ -177,13 +180,15 @@ declare module 'node:console' {
* // Prints: error 5, to stderr
* ```
*
* If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string
* values are concatenated. See `util.format()` for more information.
* If formatting elements (e.g. `%d`) are not found in the first string then
* [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options) is called on each argument and the
* resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)
* for more information.
* @since v0.1.100
*/
error(message?: any, ...optionalParams: any[]): void;
/**
* Increases indentation of subsequent lines by spaces for `groupIndentation`length.
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
*
* If one or more `label`s are provided, those are printed first without the
* additional indentation.
@@ -196,7 +201,7 @@ declare module 'node:console' {
*/
groupCollapsed(...label: any[]): void;
/**
* Decreases indentation of subsequent lines by spaces for `groupIndentation`length.
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
* @since v8.5.0
*/
groupEnd(): void;
@@ -208,7 +213,8 @@ declare module 'node:console' {
/**
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
* first used as the primary message and all additional used as substitution
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)).
*
* ```js
* const count = 5;
@@ -218,13 +224,13 @@ declare module 'node:console' {
* // Prints: count: 5, to stdout
* ```
*
* See `util.format()` for more information.
* See [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args) for more information.
* @since v0.1.100
*/
log(message?: any, ...optionalParams: any[]): void;
/**
* Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
* logging the argument if it cant be parsed as tabular.
* Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just
* logging the argument if it can't be parsed as tabular.
*
* ```js
* // These can't be parsed as tabular data
@@ -253,13 +259,14 @@ declare module 'node:console' {
* @since v10.0.0
* @param properties Alternate properties for constructing the table.
*/
table(tabularData: any, properties?: ReadonlyArray<string>): void;
table(tabularData: any, properties?: readonly string[]): void;
/**
* Starts a timer that can be used to compute the duration of an operation. Timers
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
* suitable time units to `stdout`. For example, if the elapsed
* time is 3869ms, `console.timeEnd()` displays "3.869s".
* @since v0.1.104
* @param [label='default']
*/
time(label?: string): void;
/**
@@ -267,12 +274,13 @@ declare module 'node:console' {
* prints the result to `stdout`:
*
* ```js
* console.time('100-elements');
* for (let i = 0; i < 100; i++) {}
* console.timeEnd('100-elements');
* // prints 100-elements: 225.438ms
* console.time('bunch-of-stuff');
* // Do a bunch of stuff.
* console.timeEnd('bunch-of-stuff');
* // Prints: bunch-of-stuff: 225.438ms
* ```
* @since v0.1.104
* @param [label='default']
*/
timeEnd(label?: string): void;
/**
@@ -288,10 +296,12 @@ declare module 'node:console' {
* console.timeEnd('process');
* ```
* @since v10.7.0
* @param [label='default']
*/
timeLog(label?: string, ...data: any[]): void;
/**
* Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code.
* Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)
* formatted message and stack trace to the current position in the code.
*
* ```js
* console.trace('Show me');
@@ -318,18 +328,32 @@ declare module 'node:console' {
warn(message?: any, ...optionalParams: any[]): void;
// --- Inspector mode only ---
/**
* This method does not display anything unless used in the inspector.
* Starts a JavaScript CPU profile with an optional label.
* This method does not display anything unless used in the inspector. The `console.profile()`
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
* is called. The profile is then added to the Profile panel of the inspector.
*
* ```js
* console.profile('MyLabel');
* // Some code
* console.profileEnd('MyLabel');
* // Adds the profile 'MyLabel' to the Profiles panel of the inspector.
* ```
* @since v8.0.0
*/
profile(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
* This method does not display anything unless used in the inspector. Stops the current
* JavaScript CPU profiling session if one has been started and prints the report to the
* Profiles panel of the inspector. See {@link profile} for an example.
*
* If this method is called without a label, the most recently started profile is stopped.
* @since v8.0.0
*/
profileEnd(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* Adds an event with the label `label` to the Timeline panel of the inspector.
* This method does not display anything unless used in the inspector. The `console.timeStamp()`
* method adds an event with the label `'label'` to the Timeline panel of the inspector.
* @since v8.0.0
*/
timeStamp(label?: string): void;
}
@@ -339,12 +363,13 @@ declare module 'node:console' {
*
* The module exports two specific components:
*
* * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
* asynchronous like all other Node.js streams. See the `note on process I/O` for
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v20.x/api/process.html#a-note-on-process-io) for
* more information.
*
* Example using the global `console`:
@@ -388,25 +413,40 @@ declare module 'node:console' {
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v20.11.1/lib/console.js)
*/
namespace console {
interface ConsoleConstructorOptions {
stdout: NodeJS.WritableStream;
stderr?: NodeJS.WritableStream | undefined;
/**
* Ignore errors when writing to the underlying streams.
* @default true
*/
ignoreErrors?: boolean | undefined;
colorMode?: boolean | 'auto' | undefined;
/**
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
* @default auto
*/
colorMode?: boolean | "auto" | undefined;
/**
* Specifies options that are passed along to
* [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options).
*/
inspectOptions?: InspectOptions | undefined;
/**
* Set group indentation
* Set group indentation.
* @default 2
*/
groupIndentation?: number | undefined;
}
interface ConsoleConstructor {
prototype: Console;
new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
new (options: ConsoleConstructorOptions): Console;
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
new(options: ConsoleConstructorOptions): Console;
}
}
var console: Console;

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,15 @@
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
/**
* The `dgram` module provides an implementation of UDP datagram sockets.
* The `node:dgram` module provides an implementation of UDP datagram sockets.
*
* ```js
* import dgram from 'dgram';
* import dgram from 'node:dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.log(`server error:\n${err.stack}`);
* console.error(`server error:\n${err.stack}`);
* server.close();
* });
*
@@ -26,15 +26,15 @@
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dgram.js)
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/dgram.js)
*/
declare module 'dgram' {
import { AddressInfo } from 'node:net';
import * as dns from 'node:dns';
import { EventEmitter, Abortable } from 'node:events';
declare module "dgram" {
import { AddressInfo } from "node:net";
import * as dns from "node:dns";
import { Abortable, EventEmitter } from "node:events";
interface RemoteInfo {
address: string;
family: 'IPv4' | 'IPv6';
family: "IPv4" | "IPv6";
port: number;
size: number;
}
@@ -44,7 +44,7 @@ declare module 'dgram' {
exclusive?: boolean | undefined;
fd?: number | undefined;
}
type SocketType = 'udp4' | 'udp6';
type SocketType = "udp4" | "udp6";
interface SocketOptions extends Abortable {
type: SocketType;
reuseAddr?: boolean | undefined;
@@ -54,7 +54,13 @@ declare module 'dgram' {
ipv6Only?: boolean | undefined;
recvBufferSize?: number | undefined;
sendBufferSize?: number | undefined;
lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
lookup?:
| ((
hostname: string,
options: dns.LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
) => void)
| undefined;
}
/**
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
@@ -63,7 +69,7 @@ declare module 'dgram' {
* (it does the right thing for both `udp4` and `udp6` sockets). The bound address
* and port can be retrieved using `socket.address().address` and `socket.address().port`.
*
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket:
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket:
*
* ```js
* const controller = new AbortController();
@@ -90,7 +96,7 @@ declare module 'dgram' {
*/
class Socket extends EventEmitter {
/**
* Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
* specified, the operating system will choose
* one interface and will add membership to it. To add membership to every
* available interface, call `addMembership` multiple times, once per interface.
@@ -101,8 +107,8 @@ declare module 'dgram' {
* When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
*
* ```js
* import cluster from 'cluster';
* import dgram from 'dgram';
* import cluster from 'node:cluster';
* import dgram from 'node:dgram';
*
* if (cluster.isPrimary) {
* cluster.fork(); // Works ok.
@@ -119,7 +125,7 @@ declare module 'dgram' {
addMembership(multicastAddress: string, multicastInterface?: string): void;
/**
* Returns an object containing the address information for a socket.
* For UDP sockets, this object will contain `address`, `family` and `port`properties.
* For UDP sockets, this object will contain `address`, `family`, and `port` properties.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.1.99
@@ -130,10 +136,10 @@ declare module 'dgram' {
* messages on a named `port` and optional `address`. If `port` is not
* specified or is `0`, the operating system will attempt to bind to a
* random port. If `address` is not specified, the operating system will
* attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is
* attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is
* called.
*
* Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very
* Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very
* useful.
*
* A bound datagram socket keeps the Node.js process running to receive
@@ -145,12 +151,12 @@ declare module 'dgram' {
* Example of a UDP server listening on port 41234:
*
* ```js
* import dgram from 'dgram';
* import dgram from 'node:dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.log(`server error:\n${err.stack}`);
* console.error(`server error:\n${err.stack}`);
* server.close();
* });
*
@@ -203,7 +209,7 @@ declare module 'dgram' {
*/
disconnect(): void;
/**
* Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
* Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
* kernel when the socket is closed or the process terminates, so most apps will
* never have reason to call this.
*
@@ -224,6 +230,16 @@ declare module 'dgram' {
* @return the `SO_SNDBUF` socket send buffer size in bytes.
*/
getSendBufferSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of bytes queued for sending.
*/
getSendQueueSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of send requests currently in the queue awaiting to be processed.
*/
getSendQueueCount(): number;
/**
* By default, binding a socket will cause it to block the Node.js process from
* exiting as long as the socket is open. The `socket.unref()` method can be used
@@ -256,14 +272,14 @@ declare module 'dgram' {
* any `TypedArray` or a `DataView`,
* the `offset` and `length` specify the offset within the `Buffer` where the
* message begins and the number of bytes in the message, respectively.
* If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that
* If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that
* contain multi-byte characters, `offset` and `length` will be calculated with
* respect to `byte length` and not the character position.
* If `msg` is an array, `offset` and `length` must not be specified.
*
* The `address` argument is a string. If the value of `address` is a host name,
* DNS will be used to resolve the address of the host. If `address` is not
* provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
* provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) will be used by default.
*
* If the socket has not been previously bound with a call to `bind`, the socket
* is assigned a random port number and is bound to the "all interfaces" address
@@ -274,7 +290,7 @@ declare module 'dgram' {
* DNS lookups delay the time to send for at least one tick of the
* Node.js event loop.
*
* The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be
* The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be
* passed as the first argument to the `callback`. If a `callback` is not given,
* the error is emitted as an `'error'` event on the `socket` object.
*
@@ -287,8 +303,8 @@ declare module 'dgram' {
* Example of sending a UDP packet to a port on `localhost`;
*
* ```js
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
@@ -300,8 +316,8 @@ declare module 'dgram' {
* Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
*
* ```js
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from('Some ');
* const buf2 = Buffer.from('bytes');
@@ -316,11 +332,11 @@ declare module 'dgram' {
* determine the optimal strategy on a case-by-case basis. Generally speaking,
* however, sending multiple buffers is faster.
*
* Example of sending a UDP packet using a socket connected to a port on`localhost`:
* Example of sending a UDP packet using a socket connected to a port on `localhost`:
*
* ```js
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
@@ -338,12 +354,42 @@ declare module 'dgram' {
* @param address Destination host name or IP address.
* @param callback Called when the message has been sent.
*/
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
send(
msg: string | Uint8Array | readonly any[],
port?: number,
address?: string,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array | readonly any[],
port?: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array | readonly any[],
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array,
offset: number,
length: number,
port?: number,
address?: string,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array,
offset: number,
length: number,
port?: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array,
offset: number,
length: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
/**
* Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
* packets may be sent to a local interface's broadcast address.
@@ -468,7 +514,7 @@ declare module 'dgram' {
* process active, allowing the process to exit even if the socket is still
* listening.
*
* Calling `socket.unref()` multiple times will have no addition effect.
* Calling `socket.unref()` multiple times will have no additional effect.
*
* The `socket.unref()` method returns a reference to the socket so calls can be
* chained.
@@ -476,10 +522,10 @@ declare module 'dgram' {
*/
unref(): this;
/**
* Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket
* Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket
* option. If the `multicastInterface` argument
* is not specified, the operating system will choose one interface and will add
* membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface.
* membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface.
*
* When called on an unbound socket, this method will implicitly bind to a random
* port, listening on all interfaces.
@@ -487,7 +533,7 @@ declare module 'dgram' {
*/
addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
/**
* Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is
* Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is
* automatically called by the kernel when the
* socket is closed or the process terminates, so most apps will never have
* reason to call this.
@@ -506,43 +552,48 @@ declare module 'dgram' {
* 5. message
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: 'close', listener: () => void): this;
addListener(event: 'connect', listener: () => void): this;
addListener(event: 'error', listener: (err: Error) => void): this;
addListener(event: 'listening', listener: () => void): this;
addListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connect", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: 'close'): boolean;
emit(event: 'connect'): boolean;
emit(event: 'error', err: Error): boolean;
emit(event: 'listening'): boolean;
emit(event: 'message', msg: Buffer, rinfo: RemoteInfo): boolean;
emit(event: "close"): boolean;
emit(event: "connect"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: 'close', listener: () => void): this;
on(event: 'connect', listener: () => void): this;
on(event: 'error', listener: (err: Error) => void): this;
on(event: 'listening', listener: () => void): this;
on(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connect", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: 'close', listener: () => void): this;
once(event: 'connect', listener: () => void): this;
once(event: 'error', listener: (err: Error) => void): this;
once(event: 'listening', listener: () => void): this;
once(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connect", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: 'close', listener: () => void): this;
prependListener(event: 'connect', listener: () => void): this;
prependListener(event: 'error', listener: (err: Error) => void): this;
prependListener(event: 'listening', listener: () => void): this;
prependListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connect", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'close', listener: () => void): this;
prependOnceListener(event: 'connect', listener: () => void): this;
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
prependOnceListener(event: 'listening', listener: () => void): this;
prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connect", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
/**
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
}
declare module 'node:dgram' {
export * from 'dgram';
declare module "node:dgram" {
export * from "dgram";
}

View File

@@ -2,13 +2,13 @@
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
/**
* The `diagnostics_channel` module provides an API to create named channels
* The `node:diagnostics_channel` module provides an API to create named channels
* to report arbitrary message data for diagnostics purposes.
*
* It can be accessed using:
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
* ```
*
* It is intended that a module writer wanting to report diagnostics messages
@@ -22,10 +22,11 @@
* channels are used along with the shape of the message data. Channel names
* should generally include the module name to avoid collisions with data from
* other modules.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
* @since v15.1.0, v14.17.0
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/diagnostics_channel.js)
*/
declare module 'diagnostics_channel' {
declare module "diagnostics_channel" {
import { AsyncLocalStorage } from "node:async_hooks";
/**
* Check if there are active subscribers to the named channel. This is helpful if
* the message you want to send might be expensive to prepare.
@@ -34,7 +35,7 @@ declare module 'diagnostics_channel' {
* performance-sensitive code.
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*
* if (diagnostics_channel.hasSubscribers('my-channel')) {
* // There are subscribers, prepare and publish message
@@ -44,14 +45,14 @@ declare module 'diagnostics_channel' {
* @param name The channel name
* @return If there are active subscribers
*/
function hasSubscribers(name: string): boolean;
function hasSubscribers(name: string | symbol): boolean;
/**
* This is the primary entry-point for anyone wanting to interact with a named
* This is the primary entry-point for anyone wanting to publish to a named
* channel. It produces a channel object which is optimized to reduce overhead at
* publish time as much as possible.
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
* ```
@@ -59,19 +60,86 @@ declare module 'diagnostics_channel' {
* @param name The channel name
* @return The named channel object
*/
function channel(name: string): Channel;
type ChannelListener = (message: unknown, name: string) => void;
function channel(name: string | symbol): Channel;
type ChannelListener = (message: unknown, name: string | symbol) => void;
/**
* Register a message handler to subscribe to this channel. This message handler
* will be run synchronously whenever a message is published to the channel. Any
* errors thrown in the message handler will trigger an `'uncaughtException'`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* diagnostics_channel.subscribe('my-channel', (message, name) => {
* // Received data
* });
* ```
* @since v18.7.0, v16.17.0
* @param name The channel name
* @param onMessage The handler to receive channel messages
*/
function subscribe(name: string | symbol, onMessage: ChannelListener): void;
/**
* Remove a message handler previously registered to this channel with {@link subscribe}.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* function onMessage(message, name) {
* // Received data
* }
*
* diagnostics_channel.subscribe('my-channel', onMessage);
*
* diagnostics_channel.unsubscribe('my-channel', onMessage);
* ```
* @since v18.7.0, v16.17.0
* @param name The channel name
* @param onMessage The previous subscribed handler to remove
* @return `true` if the handler was found, `false` otherwise.
*/
function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
/**
* Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
* channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channelsByName = diagnostics_channel.tracingChannel('my-channel');
*
* // or...
*
* const channelsByCollection = diagnostics_channel.tracingChannel({
* start: diagnostics_channel.channel('tracing:my-channel:start'),
* end: diagnostics_channel.channel('tracing:my-channel:end'),
* asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
* asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
* error: diagnostics_channel.channel('tracing:my-channel:error'),
* });
* ```
* @since v19.9.0
* @experimental
* @param nameOrChannels Channel name or object containing all the `TracingChannel Channels`
* @return Collection of channels to trace with
*/
function tracingChannel<
StoreType = unknown,
ContextType extends object = StoreType extends object ? StoreType : object,
>(
nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>,
): TracingChannel<StoreType, ContextType>;
/**
* The class `Channel` represents an individual named channel within the data
* pipeline. It is use to track subscribers and to publish messages when there
* pipeline. It is used to track subscribers and to publish messages when there
* are subscribers present. It exists as a separate object to avoid channel
* lookups at publish time, enabling very fast publish speeds and allowing
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
* with `new Channel(name)` is not supported.
* @since v15.1.0, v14.17.0
*/
class Channel {
readonly name: string;
class Channel<StoreType = unknown, ContextType = StoreType> {
readonly name: string | symbol;
/**
* Check if there are active subscribers to this channel. This is helpful if
* the message you want to send might be expensive to prepare.
@@ -80,7 +148,7 @@ declare module 'diagnostics_channel' {
* performance-sensitive code.
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@@ -91,19 +159,18 @@ declare module 'diagnostics_channel' {
* @since v15.1.0, v14.17.0
*/
readonly hasSubscribers: boolean;
private constructor(name: string);
private constructor(name: string | symbol);
/**
* Publish a message to any subscribers to the channel. This will
* trigger message handlers synchronously so they will execute within
* the same context.
* Publish a message to any subscribers to the channel. This will trigger
* message handlers synchronously so they will execute within the same context.
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.publish({
* some: 'message'
* some: 'message',
* });
* ```
* @since v15.1.0, v14.17.0
@@ -116,7 +183,7 @@ declare module 'diagnostics_channel' {
* errors thrown in the message handler will trigger an `'uncaughtException'`.
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@@ -125,6 +192,7 @@ declare module 'diagnostics_channel' {
* });
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
* @param onMessage The handler to receive channel messages
*/
subscribe(onMessage: ChannelListener): void;
@@ -132,7 +200,7 @@ declare module 'diagnostics_channel' {
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@@ -145,12 +213,345 @@ declare module 'diagnostics_channel' {
* channel.unsubscribe(onMessage);
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
* @param onMessage The previous subscribed handler to remove
* @return `true` if the handler was found, `false` otherwise.
*/
unsubscribe(onMessage: ChannelListener): void;
/**
* When `channel.runStores(context, ...)` is called, the given context data
* will be applied to any store bound to the channel. If the store has already been
* bound the previous `transform` function will be replaced with the new one.
* The `transform` function may be omitted to set the given context data as the
* context directly.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store, (data) => {
* return { data };
* });
* ```
* @since v19.9.0
* @experimental
* @param store The store to which to bind the context data
* @param transform Transform context data before setting the store context
*/
bindStore(store: AsyncLocalStorage<StoreType>, transform?: (context: ContextType) => StoreType): void;
/**
* Remove a message handler previously registered to this channel with `channel.bindStore(store)`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store);
* channel.unbindStore(store);
* ```
* @since v19.9.0
* @experimental
* @param store The store to unbind from the channel.
* @return `true` if the store was found, `false` otherwise.
*/
unbindStore(store: any): void;
/**
* Applies the given data to any AsyncLocalStorage instances bound to the channel
* for the duration of the given function, then publishes to the channel within
* the scope of that data is applied to the stores.
*
* If a transform function was given to `channel.bindStore(store)` it will be
* applied to transform the message data before it becomes the context value for
* the store. The prior storage context is accessible from within the transform
* function in cases where context linking is required.
*
* The context applied to the store should be accessible in any async code which
* continues from execution which began during the given function, however
* there are some situations in which `context loss` may occur.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store, (message) => {
* const parent = store.getStore();
* return new Span(message, parent);
* });
* channel.runStores({ some: 'message' }, () => {
* store.getStore(); // Span({ some: 'message' })
* });
* ```
* @since v19.9.0
* @experimental
* @param context Message to send to subscribers and bind to stores
* @param fn Handler to run within the entered storage context
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
runStores(): void;
}
interface TracingChannelSubscribers<ContextType extends object> {
start: (message: ContextType) => void;
end: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
asyncStart: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
asyncEnd: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
error: (
message: ContextType & {
error: unknown;
},
) => void;
}
interface TracingChannelCollection<StoreType = unknown, ContextType = StoreType> {
start: Channel<StoreType, ContextType>;
end: Channel<StoreType, ContextType>;
asyncStart: Channel<StoreType, ContextType>;
asyncEnd: Channel<StoreType, ContextType>;
error: Channel<StoreType, ContextType>;
}
/**
* The class `TracingChannel` is a collection of `TracingChannel Channels` which
* together express a single traceable action. It is used to formalize and
* simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a
* single `TracingChannel` at the top-level of the file rather than creating them
* dynamically.
* @since v19.9.0
* @experimental
*/
class TracingChannel<StoreType = unknown, ContextType extends object = {}> implements TracingChannelCollection {
start: Channel<StoreType, ContextType>;
end: Channel<StoreType, ContextType>;
asyncStart: Channel<StoreType, ContextType>;
asyncEnd: Channel<StoreType, ContextType>;
error: Channel<StoreType, ContextType>;
/**
* Helper to subscribe a collection of functions to the corresponding channels.
* This is the same as calling `channel.subscribe(onMessage)` on each channel
* individually.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.subscribe({
* start(message) {
* // Handle start message
* },
* end(message) {
* // Handle end message
* },
* asyncStart(message) {
* // Handle asyncStart message
* },
* asyncEnd(message) {
* // Handle asyncEnd message
* },
* error(message) {
* // Handle error message
* },
* });
* ```
* @since v19.9.0
* @experimental
* @param subscribers Set of `TracingChannel Channels` subscribers
*/
subscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
/**
* Helper to unsubscribe a collection of functions from the corresponding channels.
* This is the same as calling `channel.unsubscribe(onMessage)` on each channel
* individually.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.unsubscribe({
* start(message) {
* // Handle start message
* },
* end(message) {
* // Handle end message
* },
* asyncStart(message) {
* // Handle asyncStart message
* },
* asyncEnd(message) {
* // Handle asyncEnd message
* },
* error(message) {
* // Handle error message
* },
* });
* ```
* @since v19.9.0
* @experimental
* @param subscribers Set of `TracingChannel Channels` subscribers
* @return `true` if all handlers were successfully unsubscribed, and `false` otherwise.
*/
unsubscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
/**
* Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error.
* This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.traceSync(() => {
* // Do something
* }, {
* some: 'thing',
* });
* ```
* @since v19.9.0
* @experimental
* @param fn Function to wrap a trace around
* @param context Shared object to correlate events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceSync<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => any,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
/**
* Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also
* produce an `error event` if the given function throws an error or the
* returned promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.tracePromise(async () => {
* // Do something
* }, {
* some: 'thing',
* });
* ```
* @since v19.9.0
* @experimental
* @param fn Promise-returning function to wrap a trace around
* @param context Shared object to correlate trace events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return Chained from promise returned by the given function
*/
tracePromise<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => Promise<any>,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
/**
* Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or
* the returned
* promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* The `position` will be -1 by default to indicate the final argument should
* be used as the callback.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.traceCallback((arg1, callback) => {
* // Do something
* callback(null, 'result');
* }, 1, {
* some: 'thing',
* }, thisArg, arg1, callback);
* ```
*
* The callback will also be run with `channel.runStores(context, ...)` which
* enables context loss recovery in some cases.
*
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
* const myStore = new AsyncLocalStorage();
*
* // The start channel sets the initial store data to something
* // and stores that store data value on the trace context object
* channels.start.bindStore(myStore, (data) => {
* const span = new Span(data);
* data.span = span;
* return span;
* });
*
* // Then asyncStart can restore from that data it stored previously
* channels.asyncStart.bindStore(myStore, (data) => {
* return data.span;
* });
* ```
* @since v19.9.0
* @experimental
* @param fn callback using function to wrap a trace around
* @param position Zero-indexed argument position of expected callback
* @param context Shared object to correlate trace events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceCallback<Fn extends (this: any, ...args: any) => any>(
fn: Fn,
position: number | undefined,
context: ContextType | undefined,
thisArg: any,
...args: Parameters<Fn>
): void;
}
}
declare module 'node:diagnostics_channel' {
export * from 'diagnostics_channel';
declare module "node:diagnostics_channel" {
export * from "diagnostics_channel";
}

View File

@@ -2,7 +2,7 @@
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
/**
* The `dns` module enables name resolution. For example, use it to look up IP
* The `node:dns` module enables name resolution. For example, use it to look up IP
* addresses of host names.
*
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
@@ -12,7 +12,7 @@
* system do, use {@link lookup}.
*
* ```js
* const dns = require('dns');
* const dns = require('node:dns');
*
* dns.lookup('example.org', (err, address, family) => {
* console.log('address: %j family: IPv%s', address, family);
@@ -20,13 +20,13 @@
* // address: "93.184.216.34" family: IPv4
* ```
*
* All other functions in the `dns` module connect to an actual DNS server to
* All other functions in the `node:dns` module connect to an actual DNS server to
* perform name resolution. They will always use the network to perform DNS
* queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
* DNS queries, bypassing other name-resolution facilities.
*
* ```js
* const dns = require('dns');
* const dns = require('node:dns');
*
* dns.resolve4('archive.org', (err, addresses) => {
* if (err) throw err;
@@ -44,13 +44,21 @@
* });
* ```
*
* See the `Implementation considerations section` for more information.
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) for more information.
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/dns.js)
*/
declare module 'dns' {
import * as dnsPromises from 'node:dns/promises';
declare module "dns" {
import * as dnsPromises from "node:dns/promises";
// Supported getaddrinfo flags.
/**
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
* only returned if the current system has at least one IPv4 address configured.
*/
export const ADDRCONFIG: number;
/**
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
* on some operating systems (e.g. FreeBSD 10.1).
*/
export const V4MAPPED: number;
/**
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
@@ -58,11 +66,37 @@ declare module 'dns' {
*/
export const ALL: number;
export interface LookupOptions {
family?: number | undefined;
/**
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
* with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned.
* @default 0
*/
family?: number | "IPv4" | "IPv6" | undefined;
/**
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v20.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
* passed by bitwise `OR`ing their values.
*/
hints?: number | undefined;
/**
* When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address.
* @default false
*/
all?: boolean | undefined;
/**
* @default true
* When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
* addresses before IPv4 addresses. Default value is configurable using
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
* @default `verbatim` (addresses are not reordered)
*/
order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
/**
* When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
* addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
* `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
* or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
* @default true (addresses are not reordered)
*/
verbatim?: boolean | undefined;
}
@@ -73,16 +107,23 @@ declare module 'dns' {
all: true;
}
export interface LookupAddress {
/**
* A string representation of an IPv4 or IPv6 address.
*/
address: string;
/**
* `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
* bug in the name resolution service used by the operating system.
*/
family: number;
}
/**
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
* integer, then it must be `4` or `6` if `options` is not provided, then IPv4
* and IPv6 addresses are both returned if found.
* integer, then it must be `4` or `6` if `options` is `0` or not provided, then
* IPv4 and IPv6 addresses are both returned if found.
*
* With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
* With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the
* properties `address` and `family`.
*
* On error, `err` is an `Error` object, where `err.code` is the error code.
@@ -92,14 +133,15 @@ declare module 'dns' {
*
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
* The implementation uses an operating system facility that can associate names
* with addresses, and vice versa. This implementation can have subtle but
* with addresses and vice versa. This implementation can have subtle but
* important consequences on the behavior of any Node.js program. Please take some
* time to consult the `Implementation considerations section` before using`dns.lookup()`.
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations)
* before using `dns.lookup()`.
*
* Example usage:
*
* ```js
* const dns = require('dns');
* const dns = require('node:dns');
* const options = {
* family: 6,
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
@@ -115,14 +157,34 @@ declare module 'dns' {
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
* ```
*
* If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
* @since v0.1.90
*/
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
export function lookup(
hostname: string,
family: number,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
export function lookup(
hostname: string,
options: LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
export function lookup(
hostname: string,
options: LookupAllOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
): void;
export function lookup(
hostname: string,
options: LookupOptions,
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
): void;
export function lookup(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
export namespace lookup {
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
@@ -133,26 +195,32 @@ declare module 'dns' {
* the operating system's underlying `getnameinfo` implementation.
*
* If `address` is not a valid IP address, a `TypeError` will be thrown.
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
*
* On an error, `err` is an `Error` object, where `err.code` is the error code.
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
* where `err.code` is the error code.
*
* ```js
* const dns = require('dns');
* const dns = require('node:dns');
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
* console.log(hostname, service);
* // Prints: localhost ssh
* });
* ```
*
* If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
* @since v0.11.14
*/
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
export function lookupService(
address: string,
port: number,
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
): void;
export namespace lookupService {
function __promisify__(
address: string,
port: number
port: number,
): Promise<{
hostname: string;
service: string;
@@ -171,13 +239,13 @@ declare module 'dns' {
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
export interface AnyARecord extends RecordWithTtl {
type: 'A';
type: "A";
}
export interface AnyAaaaRecord extends RecordWithTtl {
type: 'AAAA';
type: "AAAA";
}
export interface CaaRecord {
critial: number;
critical: number;
issue?: string | undefined;
issuewild?: string | undefined;
iodef?: string | undefined;
@@ -189,7 +257,7 @@ declare module 'dns' {
exchange: string;
}
export interface AnyMxRecord extends MxRecord {
type: 'MX';
type: "MX";
}
export interface NaptrRecord {
flags: string;
@@ -200,7 +268,7 @@ declare module 'dns' {
preference: number;
}
export interface AnyNaptrRecord extends NaptrRecord {
type: 'NAPTR';
type: "NAPTR";
}
export interface SoaRecord {
nsname: string;
@@ -212,7 +280,7 @@ declare module 'dns' {
minttl: number;
}
export interface AnySoaRecord extends SoaRecord {
type: 'SOA';
type: "SOA";
}
export interface SrvRecord {
priority: number;
@@ -221,122 +289,217 @@ declare module 'dns' {
name: string;
}
export interface AnySrvRecord extends SrvRecord {
type: 'SRV';
type: "SRV";
}
export interface AnyTxtRecord {
type: 'TXT';
type: "TXT";
entries: string[];
}
export interface AnyNsRecord {
type: 'NS';
type: "NS";
value: string;
}
export interface AnyPtrRecord {
type: 'PTR';
type: "PTR";
value: string;
}
export interface AnyCnameRecord {
type: 'CNAME';
type: "CNAME";
value: string;
}
export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord;
export type AnyRecord =
| AnyARecord
| AnyAaaaRecord
| AnyCnameRecord
| AnyMxRecord
| AnyNaptrRecord
| AnyNsRecord
| AnyPtrRecord
| AnySoaRecord
| AnySrvRecord
| AnyTxtRecord;
/**
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
* of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
* of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource
* records. The type and structure of individual results varies based on `rrtype`:
*
* <omitted>
*
* On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
* where `err.code` is one of the `DNS error codes`.
* @since v0.1.27
* @param hostname Host name to resolve.
* @param [rrtype='A'] Resource record type.
*/
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
export function resolve(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "A",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "AAAA",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "ANY",
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "CNAME",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "MX",
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "NAPTR",
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "NS",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "PTR",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "SOA",
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
): void;
export function resolve(
hostname: string,
rrtype: "SRV",
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "TXT",
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
): void;
export function resolve(
hostname: string,
rrtype: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
callback: (
err: NodeJS.ErrnoException | null,
addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[],
) => void,
): void;
export namespace resolve {
function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise<string[]>;
function __promisify__(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
function __promisify__(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
function __promisify__(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
function __promisify__(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
function __promisify__(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
function __promisify__(
hostname: string,
rrtype: string,
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
}
/**
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function
* will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
* @since v0.1.16
* @param hostname Host name to resolve.
*/
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
export function resolve4(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve4(
hostname: string,
options: ResolveWithTtlOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
): void;
export function resolve4(
hostname: string,
options: ResolveOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
): void;
export namespace resolve4 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
}
/**
* Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function
* will contain an array of IPv6 addresses.
* @since v0.1.16
* @param hostname Host name to resolve.
*/
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
export function resolve6(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve6(
hostname: string,
options: ResolveWithTtlOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
): void;
export function resolve6(
hostname: string,
options: ResolveOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
): void;
export namespace resolve6 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
}
/**
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function
* will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
* @since v0.3.2
*/
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolveCname(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export namespace resolveCname {
function __promisify__(hostname: string): Promise<string[]>;
}
/**
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function
* will contain an array of certification authority authorization records
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
* @since v15.0.0, v14.17.0
*/
export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
export function resolveCaa(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
): void;
export namespace resolveCaa {
function __promisify__(hostname: string): Promise<CaaRecord[]>;
}
/**
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
* contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
* @since v0.1.27
*/
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
export function resolveMx(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
): void;
export namespace resolveMx {
function __promisify__(hostname: string): Promise<MxRecord[]>;
}
/**
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of
* objects with the following properties:
*
* * `flags`
@@ -358,25 +521,34 @@ declare module 'dns' {
* ```
* @since v0.9.12
*/
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
export function resolveNaptr(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
): void;
export namespace resolveNaptr {
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
}
/**
* Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
* contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
* @since v0.1.90
*/
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolveNs(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export namespace resolveNs {
function __promisify__(hostname: string): Promise<string[]>;
}
/**
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
* be an array of strings containing the reply records.
* @since v6.0.0
*/
export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolvePtr(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export namespace resolvePtr {
function __promisify__(hostname: string): Promise<string[]>;
}
@@ -406,12 +578,15 @@ declare module 'dns' {
* ```
* @since v0.11.10
*/
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
export function resolveSoa(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
): void;
export namespace resolveSoa {
function __promisify__(hostname: string): Promise<SoaRecord>;
}
/**
* Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
* be an array of objects with the following properties:
*
* * `priority`
@@ -429,18 +604,24 @@ declare module 'dns' {
* ```
* @since v0.1.27
*/
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
export function resolveSrv(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
): void;
export namespace resolveSrv {
function __promisify__(hostname: string): Promise<SrvRecord[]>;
}
/**
* Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
* two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
* one record. Depending on the use case, these could be either joined together or
* treated separately.
* @since v0.1.27
*/
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
export function resolveTxt(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
): void;
export namespace resolveTxt {
function __promisify__(hostname: string): Promise<string[][]>;
}
@@ -471,10 +652,13 @@ declare module 'dns' {
* minttl: 60 } ]
* ```
*
* DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
* 8482](https://tools.ietf.org/html/rfc8482).
* DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
* [RFC 8482](https://tools.ietf.org/html/rfc8482).
*/
export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
export function resolveAny(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
): void;
export namespace resolveAny {
function __promisify__(hostname: string): Promise<AnyRecord[]>;
}
@@ -482,11 +666,24 @@ declare module 'dns' {
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
* array of host names.
*
* On error, `err` is an `Error` object, where `err.code` is
* one of the `DNS error codes`.
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is
* one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
* @since v0.1.16
*/
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
export function reverse(
ip: string,
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
): void;
/**
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
* The value could be:
*
* * `ipv4first`: for `order` defaulting to `ipv4first`.
* * `ipv6first`: for `order` defaulting to `ipv6first`.
* * `verbatim`: for `order` defaulting to `verbatim`.
* @since v18.17.0
*/
export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
/**
* Sets the IP address and port of servers to be used when performing DNS
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@@ -506,16 +703,16 @@ declare module 'dns' {
* The `dns.setServers()` method must not be called while a DNS query is in
* progress.
*
* The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
* The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
*
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
* That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
* That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
* subsequent servers provided. Fallback DNS servers will only be used if the
* earlier ones time out or result in some other error.
* @since v0.11.3
* @param servers array of `RFC 5952` formatted addresses
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
*/
export function setServers(servers: ReadonlyArray<string>): void;
export function setServers(servers: readonly string[]): void;
/**
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
* that are currently configured for DNS resolution. A string will include a port
@@ -533,46 +730,53 @@ declare module 'dns' {
*/
export function getServers(): string[];
/**
* Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
* The value could be:
*
* * `ipv4first`: sets default `verbatim` `false`.
* * `verbatim`: sets default `verbatim` `true`.
* * `ipv4first`: sets default `order` to `ipv4first`.
* * `ipv6first`: sets default `order` to `ipv6first`.
* * `verbatim`: sets default `order` to `verbatim`.
*
* The default is `ipv4first` and {@link setDefaultResultOrder} have higher
* priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default
* dns orders in workers.
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder). When using
* [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
* thread won't affect the default dns orders in workers.
* @since v16.4.0, v14.18.0
* @param order must be `'ipv4first'` or `'verbatim'`.
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
*/
export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
// Error codes
export const NODATA: string;
export const FORMERR: string;
export const SERVFAIL: string;
export const NOTFOUND: string;
export const NOTIMP: string;
export const REFUSED: string;
export const BADQUERY: string;
export const BADNAME: string;
export const BADFAMILY: string;
export const BADRESP: string;
export const CONNREFUSED: string;
export const TIMEOUT: string;
export const EOF: string;
export const FILE: string;
export const NOMEM: string;
export const DESTRUCTION: string;
export const BADSTR: string;
export const BADFLAGS: string;
export const NONAME: string;
export const BADHINTS: string;
export const NOTINITIALIZED: string;
export const LOADIPHLPAPI: string;
export const ADDRGETNETWORKPARAMS: string;
export const CANCELLED: string;
export const NODATA: "ENODATA";
export const FORMERR: "EFORMERR";
export const SERVFAIL: "ESERVFAIL";
export const NOTFOUND: "ENOTFOUND";
export const NOTIMP: "ENOTIMP";
export const REFUSED: "EREFUSED";
export const BADQUERY: "EBADQUERY";
export const BADNAME: "EBADNAME";
export const BADFAMILY: "EBADFAMILY";
export const BADRESP: "EBADRESP";
export const CONNREFUSED: "ECONNREFUSED";
export const TIMEOUT: "ETIMEOUT";
export const EOF: "EOF";
export const FILE: "EFILE";
export const NOMEM: "ENOMEM";
export const DESTRUCTION: "EDESTRUCTION";
export const BADSTR: "EBADSTR";
export const BADFLAGS: "EBADFLAGS";
export const NONAME: "ENONAME";
export const BADHINTS: "EBADHINTS";
export const NOTINITIALIZED: "ENOTINITIALIZED";
export const LOADIPHLPAPI: "ELOADIPHLPAPI";
export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
export const CANCELLED: "ECANCELLED";
export interface ResolverOptions {
/**
* Query timeout in milliseconds, or `-1` to use the default timeout.
*/
timeout?: number | undefined;
/**
* The number of tries the resolver will try contacting each name server before giving up.
* @default 4
*/
tries?: number;
@@ -581,11 +785,11 @@ declare module 'dns' {
* An independent resolver for DNS requests.
*
* Creating a new resolver uses the default server settings. Setting
* the servers used for a resolver using `resolver.setServers()` does not affect
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnssetserversservers) does not affect
* other resolvers:
*
* ```js
* const { Resolver } = require('dns');
* const { Resolver } = require('node:dns');
* const resolver = new Resolver();
* resolver.setServers(['4.4.4.4']);
*
@@ -595,7 +799,7 @@ declare module 'dns' {
* });
* ```
*
* The following methods from the `dns` module are available:
* The following methods from the `node:dns` module are available:
*
* * `resolver.getServers()`
* * `resolver.resolve()`
@@ -628,6 +832,7 @@ declare module 'dns' {
resolve4: typeof resolve4;
resolve6: typeof resolve6;
resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;
resolveMx: typeof resolveMx;
resolveNaptr: typeof resolveNaptr;
@@ -642,7 +847,7 @@ declare module 'dns' {
* This allows programs to specify outbound interfaces when used on multi-homed
* systems.
*
* If a v4 or v6 address is not specified, it is set to the default, and the
* If a v4 or v6 address is not specified, it is set to the default and the
* operating system will choose a local address automatically.
*
* The resolver will use the v4 local address when making requests to IPv4 DNS
@@ -657,6 +862,6 @@ declare module 'dns' {
}
export { dnsPromises as promises };
}
declare module 'node:dns' {
export * from 'dns';
declare module "node:dns" {
export * from "dns";
}

View File

@@ -4,26 +4,26 @@
/**
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
* that return `Promise` objects rather than using callbacks. The API is accessible
* via `require('dns').promises` or `require('dns/promises')`.
* via `require('node:dns').promises` or `require('node:dns/promises')`.
* @since v10.6.0
*/
declare module 'dns/promises' {
declare module "dns/promises" {
import {
LookupAddress,
LookupOneOptions,
LookupAllOptions,
LookupOptions,
AnyRecord,
CaaRecord,
LookupAddress,
LookupAllOptions,
LookupOneOptions,
LookupOptions,
MxRecord,
NaptrRecord,
SoaRecord,
SrvRecord,
ResolveWithTtlOptions,
RecordWithTtl,
ResolveOptions,
ResolverOptions,
} from 'node:dns';
ResolveWithTtlOptions,
SoaRecord,
SrvRecord,
} from "node:dns";
/**
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
* that are currently configured for DNS resolution. A string will include a port
@@ -46,24 +46,24 @@ declare module 'dns/promises' {
* integer, then it must be `4` or `6` if `options` is not provided, then IPv4
* and IPv6 addresses are both returned if found.
*
* With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`.
* With the `all` option set to `true`, the `Promise` is resolved with `addresses` being an array of objects with the properties `address` and `family`.
*
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
* the host name does not exist but also when the lookup fails in other ways
* such as no available file descriptors.
*
* `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
* [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options) does not necessarily have anything to do with the DNS
* protocol. The implementation uses an operating system facility that can
* associate names with addresses, and vice versa. This implementation can have
* associate names with addresses and vice versa. This implementation can have
* subtle but important consequences on the behavior of any Node.js program. Please
* take some time to consult the `Implementation considerations section` before
* take some time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) before
* using `dnsPromises.lookup()`.
*
* Example usage:
*
* ```js
* const dns = require('dns');
* const dns = require('node:dns');
* const dnsPromises = dns.promises;
* const options = {
* family: 6,
@@ -94,12 +94,12 @@ declare module 'dns/promises' {
* the operating system's underlying `getnameinfo` implementation.
*
* If `address` is not a valid IP address, a `TypeError` will be thrown.
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
*
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
*
* ```js
* const dnsPromises = require('dns').promises;
* const dnsPromises = require('node:dns').promises;
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
* console.log(result.hostname, result.service);
* // Prints: localhost ssh
@@ -109,7 +109,7 @@ declare module 'dns/promises' {
*/
function lookupService(
address: string,
port: number
port: number,
): Promise<{
hostname: string;
service: string;
@@ -122,27 +122,31 @@ declare module 'dns/promises' {
*
* <omitted>
*
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code`
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
* @since v10.6.0
* @param hostname Host name to resolve.
* @param [rrtype='A'] Resource record type.
*/
function resolve(hostname: string): Promise<string[]>;
function resolve(hostname: string, rrtype: 'A'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'AAAA'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
function resolve(hostname: string, rrtype: 'CAA'): Promise<CaaRecord[]>;
function resolve(hostname: string, rrtype: 'CNAME'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
function resolve(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
function resolve(hostname: string, rrtype: 'NS'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'PTR'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
function resolve(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
function resolve(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
function resolve(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
function resolve(
hostname: string,
rrtype: string,
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
/**
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4
* addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
* @since v10.6.0
* @param hostname Host name to resolve.
@@ -151,7 +155,7 @@ declare module 'dns/promises' {
function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
/**
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6
* addresses.
* @since v10.6.0
* @param hostname Host name to resolve.
@@ -191,7 +195,7 @@ declare module 'dns/promises' {
/**
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
* the `Promise` is resolved with an array of objects containing available
* certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
* certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
* @since v15.0.0, v14.17.0
*/
function resolveCaa(hostname: string): Promise<CaaRecord[]>;
@@ -203,13 +207,13 @@ declare module 'dns/promises' {
*/
function resolveCname(hostname: string): Promise<string[]>;
/**
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects
* containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`).
* @since v10.6.0
*/
function resolveMx(hostname: string): Promise<MxRecord[]>;
/**
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. On success, the `Promise` is resolved with an array
* of objects with the following properties:
*
* * `flags`
@@ -233,13 +237,13 @@ declare module 'dns/promises' {
*/
function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
/**
* Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server
* records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`).
* @since v10.6.0
*/
function resolveNs(hostname: string): Promise<string[]>;
/**
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings
* containing the reply records.
* @since v10.6.0
*/
@@ -272,7 +276,7 @@ declare module 'dns/promises' {
*/
function resolveSoa(hostname: string): Promise<SoaRecord>;
/**
* Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with
* the following properties:
*
* * `priority`
@@ -292,7 +296,7 @@ declare module 'dns/promises' {
*/
function resolveSrv(hostname: string): Promise<SrvRecord[]>;
/**
* Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
* of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
* one record. Depending on the use case, these could be either joined together or
* treated separately.
@@ -303,10 +307,20 @@ declare module 'dns/promises' {
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
* array of host names.
*
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code`
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
* @since v10.6.0
*/
function reverse(ip: string): Promise<string[]>;
/**
* Get the default value for `verbatim` in {@link lookup} and [dnsPromises.lookup()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
* The value could be:
*
* * `ipv4first`: for `verbatim` defaulting to `false`.
* * `verbatim`: for `verbatim` defaulting to `true`.
* @since v20.1.0
*/
function getDefaultResultOrder(): "ipv4first" | "verbatim";
/**
* Sets the IP address and port of servers to be used when performing DNS
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@@ -327,34 +341,111 @@ declare module 'dns/promises' {
* progress.
*
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
* That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
* That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
* subsequent servers provided. Fallback DNS servers will only be used if the
* earlier ones time out or result in some other error.
* @since v10.6.0
* @param servers array of `RFC 5952` formatted addresses
*/
function setServers(servers: ReadonlyArray<string>): void;
function setServers(servers: readonly string[]): void;
/**
* Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:
* Set the default value of `order` in `dns.lookup()` and `{@link lookup}`. The value could be:
*
* * `ipv4first`: sets default `verbatim` `false`.
* * `verbatim`: sets default `verbatim` `true`.
* * `ipv4first`: sets default `order` to `ipv4first`.
* * `ipv6first`: sets default `order` to `ipv6first`.
* * `verbatim`: sets default `order` to `verbatim`.
*
* The default is `ipv4first` and `dnsPromises.setDefaultResultOrder()` have
* higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the
* default dns orders in workers.
* The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
* have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
* When using [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
* from the main thread won't affect the default dns orders in workers.
* @since v16.4.0, v14.18.0
* @param order must be `'ipv4first'` or `'verbatim'`.
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
*/
function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
// Error codes
const NODATA: "ENODATA";
const FORMERR: "EFORMERR";
const SERVFAIL: "ESERVFAIL";
const NOTFOUND: "ENOTFOUND";
const NOTIMP: "ENOTIMP";
const REFUSED: "EREFUSED";
const BADQUERY: "EBADQUERY";
const BADNAME: "EBADNAME";
const BADFAMILY: "EBADFAMILY";
const BADRESP: "EBADRESP";
const CONNREFUSED: "ECONNREFUSED";
const TIMEOUT: "ETIMEOUT";
const EOF: "EOF";
const FILE: "EFILE";
const NOMEM: "ENOMEM";
const DESTRUCTION: "EDESTRUCTION";
const BADSTR: "EBADSTR";
const BADFLAGS: "EBADFLAGS";
const NONAME: "ENONAME";
const BADHINTS: "EBADHINTS";
const NOTINITIALIZED: "ENOTINITIALIZED";
const LOADIPHLPAPI: "ELOADIPHLPAPI";
const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
const CANCELLED: "ECANCELLED";
/**
* An independent resolver for DNS requests.
*
* Creating a new resolver uses the default server settings. Setting
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetserversservers) does not affect
* other resolvers:
*
* ```js
* const { Resolver } = require('node:dns').promises;
* const resolver = new Resolver();
* resolver.setServers(['4.4.4.4']);
*
* // This request will use the server at 4.4.4.4, independent of global settings.
* resolver.resolve4('example.org').then((addresses) => {
* // ...
* });
*
* // Alternatively, the same code can be written using async-await style.
* (async function() {
* const addresses = await resolver.resolve4('example.org');
* })();
* ```
*
* The following methods from the `dnsPromises` API are available:
*
* * `resolver.getServers()`
* * `resolver.resolve()`
* * `resolver.resolve4()`
* * `resolver.resolve6()`
* * `resolver.resolveAny()`
* * `resolver.resolveCaa()`
* * `resolver.resolveCname()`
* * `resolver.resolveMx()`
* * `resolver.resolveNaptr()`
* * `resolver.resolveNs()`
* * `resolver.resolvePtr()`
* * `resolver.resolveSoa()`
* * `resolver.resolveSrv()`
* * `resolver.resolveTxt()`
* * `resolver.reverse()`
* * `resolver.setServers()`
* @since v10.6.0
*/
function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
class Resolver {
constructor(options?: ResolverOptions);
/**
* Cancel all outstanding DNS queries made by this resolver. The corresponding
* callbacks will be called with an error with code `ECANCELLED`.
* @since v8.3.0
*/
cancel(): void;
getServers: typeof getServers;
resolve: typeof resolve;
resolve4: typeof resolve4;
resolve6: typeof resolve6;
resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;
resolveMx: typeof resolveMx;
resolveNaptr: typeof resolveNaptr;
@@ -364,10 +455,25 @@ declare module 'dns/promises' {
resolveSrv: typeof resolveSrv;
resolveTxt: typeof resolveTxt;
reverse: typeof reverse;
/**
* The resolver instance will send its requests from the specified IP address.
* This allows programs to specify outbound interfaces when used on multi-homed
* systems.
*
* If a v4 or v6 address is not specified, it is set to the default and the
* operating system will choose a local address automatically.
*
* The resolver will use the v4 local address when making requests to IPv4 DNS
* servers, and the v6 local address when making requests to IPv6 DNS servers.
* The `rrtype` of resolution requests has no impact on the local address used.
* @since v15.1.0, v14.17.0
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
* @param [ipv6='::0'] A string representation of an IPv6 address.
*/
setLocalAddress(ipv4?: string, ipv6?: string): void;
setServers: typeof setServers;
}
}
declare module 'node:dns/promises' {
export * from 'dns/promises';
declare module "node:dns/promises" {
export * from "dns/promises";
}

View File

@@ -11,72 +11,70 @@ export {}; // Don't export anything!
// This conditional type will be the existing global Event in a browser, or
// the copy below in a Node environment.
type __Event = typeof globalThis extends { onmessage: any, Event: any }
? {}
: {
/** This is not used in Node.js and is provided purely for completeness. */
readonly bubbles: boolean;
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
cancelBubble: () => void;
/** True if the event was created with the cancelable option */
readonly cancelable: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly composed: boolean;
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
composedPath(): [EventTarget?]
/** Alias for event.target. */
readonly currentTarget: EventTarget | null;
/** Is true if cancelable is true and event.preventDefault() has been called. */
readonly defaultPrevented: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly eventPhase: 0 | 2;
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
readonly isTrusted: boolean;
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
preventDefault(): void;
/** This is not used in Node.js and is provided purely for completeness. */
returnValue: boolean;
/** Alias for event.target. */
readonly srcElement: EventTarget | null;
/** Stops the invocation of event listeners after the current one completes. */
stopImmediatePropagation(): void;
/** This is not used in Node.js and is provided purely for completeness. */
stopPropagation(): void;
/** The `EventTarget` dispatching the event */
readonly target: EventTarget | null;
/** The millisecond timestamp when the Event object was created. */
readonly timeStamp: number;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string;
};
type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {}
: {
/** This is not used in Node.js and is provided purely for completeness. */
readonly bubbles: boolean;
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
cancelBubble: () => void;
/** True if the event was created with the cancelable option */
readonly cancelable: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly composed: boolean;
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
composedPath(): [EventTarget?];
/** Alias for event.target. */
readonly currentTarget: EventTarget | null;
/** Is true if cancelable is true and event.preventDefault() has been called. */
readonly defaultPrevented: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly eventPhase: 0 | 2;
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
readonly isTrusted: boolean;
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
preventDefault(): void;
/** This is not used in Node.js and is provided purely for completeness. */
returnValue: boolean;
/** Alias for event.target. */
readonly srcElement: EventTarget | null;
/** Stops the invocation of event listeners after the current one completes. */
stopImmediatePropagation(): void;
/** This is not used in Node.js and is provided purely for completeness. */
stopPropagation(): void;
/** The `EventTarget` dispatching the event */
readonly target: EventTarget | null;
/** The millisecond timestamp when the Event object was created. */
readonly timeStamp: number;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string;
};
// See comment above explaining conditional type
type __EventTarget = typeof globalThis extends { onmessage: any, EventTarget: any }
? {}
: {
/**
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
*
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
*
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
*/
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
dispatchEvent(event: Event): boolean;
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
};
type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {}
: {
/**
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
*
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
*
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
*/
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
dispatchEvent(event: Event): boolean;
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
};
interface EventInit {
bubbles?: boolean;
@@ -94,6 +92,8 @@ interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
passive?: boolean;
/** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
signal?: AbortSignal;
}
interface EventListener {
@@ -104,15 +104,14 @@ interface EventListenerObject {
handleEvent(object: Event): void;
}
import {} from 'events'; // Make this an ambient declaration
import {} from "events"; // Make this an ambient declaration
declare global {
/** An event which takes place in the DOM. */
interface Event extends __Event {}
var Event: typeof globalThis extends { onmessage: any, Event: infer T }
? T
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
: {
prototype: __Event;
new (type: string, eventInitDict?: EventInit): __Event;
new(type: string, eventInitDict?: EventInit): __Event;
};
/**
@@ -120,10 +119,9 @@ declare global {
* receive events and may have listeners for them.
*/
interface EventTarget extends __EventTarget {}
var EventTarget: typeof globalThis extends { onmessage: any, EventTarget: infer T }
? T
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
: {
prototype: __EventTarget;
new (): __EventTarget;
new(): __EventTarget;
};
}

View File

@@ -12,13 +12,13 @@
* Domains provide a way to handle multiple different IO operations as a
* single group. If any of the event emitters or callbacks registered to a
* domain emit an `'error'` event, or throw an error, then the domain object
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
* will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to
* exit immediately with an error code.
* @deprecated Since v1.4.2 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/domain.js)
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/domain.js)
*/
declare module 'domain' {
import EventEmitter = require('node:events');
declare module "domain" {
import EventEmitter = require("node:events");
/**
* The `Domain` class encapsulates the functionality of routing errors and
* uncaught exceptions to the active `Domain` object.
@@ -32,7 +32,7 @@ declare module 'domain' {
*/
members: Array<EventEmitter | NodeJS.Timer>;
/**
* The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
* pushes the domain onto the domain
* stack managed by the domain module (see {@link exit} for details on the
* domain stack). The call to `enter()` delimits the beginning of a chain of
@@ -50,7 +50,7 @@ declare module 'domain' {
* The call to `exit()` delimits either the end of or an interruption to the chain
* of asynchronous calls and I/O operations bound to a domain.
*
* If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain.
* If there are multiple, nested domains bound to the current execution context, `exit()` will exit any domains nested within this domain.
*
* Calling `exit()` changes only the active domain, and does not alter the domain
* itself. `enter()` and `exit()` can be called an arbitrary number of times on a
@@ -59,15 +59,15 @@ declare module 'domain' {
exit(): void;
/**
* Run the supplied function in the context of the domain, implicitly
* binding all event emitters, timers, and lowlevel requests that are
* binding all event emitters, timers, and low-level requests that are
* created in that context. Optionally, arguments can be passed to
* the function.
*
* This is the most basic way to use a domain.
*
* ```js
* const domain = require('domain');
* const fs = require('fs');
* const domain = require('node:domain');
* const fs = require('node:fs');
* const d = domain.create();
* d.on('error', (er) => {
* console.error('Caught error!', er);
@@ -168,6 +168,6 @@ declare module 'domain' {
}
function create(): Domain;
}
declare module 'node:domain' {
export * from 'domain';
declare module "node:domain" {
export * from "domain";
}

View File

@@ -25,7 +25,7 @@
* the `eventEmitter.emit()` method is used to trigger the event.
*
* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
*
* class MyEmitter extends EventEmitter {}
*
@@ -35,13 +35,13 @@
* });
* myEmitter.emit('event');
* ```
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/events.js)
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/events.js)
*/
declare module 'events' {
declare module "events" {
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
// NOTE: This class is in the docs but is **not actually exported** by Node.
// If https://github.com/nodejs/node/issues/39903 gets resolved and Node
// actually starts exporting the class, uncomment below.
// import { EventListener, EventListenerObject } from '__dom-events';
// /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
// interface NodeEventTarget extends EventTarget {
@@ -72,36 +72,74 @@ declare module 'events' {
// */
// removeListener(type: string, listener: EventListener | EventListenerObject): this;
// }
interface EventEmitterOptions {
/**
* Enables automatic capturing of promise rejection.
*/
captureRejections?: boolean | undefined;
}
// Any EventTarget with a Node-style `once` function
interface _NodeEventTarget {
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
}
// Any EventTarget with a DOM-style `addEventListener`
interface _DOMEventTarget {
addEventListener(
eventName: string,
listener: (...args: any[]) => void,
opts?: {
once: boolean;
}
): any;
}
interface StaticEventEmitterOptions {
/**
* Can be used to cancel awaiting events.
*/
signal?: AbortSignal | undefined;
/**
* Names of events that will end the iteration.
*/
close?: string[] | undefined;
/**
* The high watermark. The emitter is paused every time the size
* of events being buffered is higher than it. Supported only
* on emitters implementing `pause()` and `resume()` methods.
* @default `Number.MAX_SAFE_INTEGER`
*/
highWaterMark?: number | undefined;
/**
* The low watermark. The emitter is resumed every time the size of events being buffered
* is lower than it. Supported only on emitters implementing `pause()` and `resume()` methods.
* @default 1
*/
lowWaterMark?: number | undefined;
}
interface EventEmitter extends NodeJS.EventEmitter {}
interface StaticEventEmitterIteratorOptions extends StaticEventEmitterOptions {
/**
* Names of events that will end the iteration.
*/
close?: string[];
/**
* The emitter is paused every time the size of events being buffered is higher than it. Supported only on emitters implementing pause() and resume() methods.
* @default Number.MAX_SAFE_INTEGER
*/
highWaterMark?: number;
/**
* The emitter is resumed every time the size of events being buffered is lower than it. Supported only on emitters implementing pause() and resume() methods.
* @default 1
*/
lowWaterMark?: number;
}
interface EventEmitter<T extends EventMap<T> = DefaultEventMap> extends NodeJS.EventEmitter<T> {}
type EventMap<T> = Record<keyof T, any[]> | DefaultEventMap;
type DefaultEventMap = [never];
type AnyRest = [...args: any[]];
type Args<K, T> = T extends DefaultEventMap ? AnyRest : (
K extends keyof T ? T[K] : never
);
type Key<K, T> = T extends DefaultEventMap ? string | symbol : K | keyof T;
type Key2<K, T> = T extends DefaultEventMap ? string | symbol : K & keyof T;
type Listener<K, T, F> = T extends DefaultEventMap ? F : (
K extends keyof T ? (
T[K] extends unknown[] ? (...args: T[K]) => void : never
)
: never
);
type Listener1<K, T> = Listener<K, T, (...args: any[]) => void>;
type Listener2<K, T> = Listener<K, T, Function>;
/**
* The `EventEmitter` class is defined and exposed by the `events` module:
* The `EventEmitter` class is defined and exposed by the `node:events` module:
*
* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
* ```
*
* All `EventEmitter`s emit the event `'newListener'` when new listeners are
@@ -110,8 +148,11 @@ declare module 'events' {
* It supports the following option:
* @since v0.1.26
*/
class EventEmitter {
class EventEmitter<T extends EventMap<T> = DefaultEventMap> {
constructor(options?: EventEmitterOptions);
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: Key<K, T>, ...args: Args<K, T>): void;
/**
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
@@ -122,45 +163,42 @@ declare module 'events' {
* semantics and does not listen to the `'error'` event.
*
* ```js
* const { once, EventEmitter } = require('events');
* import { once, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* async function run() {
* const ee = new EventEmitter();
* const ee = new EventEmitter();
*
* process.nextTick(() => {
* ee.emit('myevent', 42);
* });
* process.nextTick(() => {
* ee.emit('myevent', 42);
* });
*
* const [value] = await once(ee, 'myevent');
* console.log(value);
* const [value] = await once(ee, 'myevent');
* console.log(value);
*
* const err = new Error('kaboom');
* process.nextTick(() => {
* ee.emit('error', err);
* });
* const err = new Error('kaboom');
* process.nextTick(() => {
* ee.emit('error', err);
* });
*
* try {
* await once(ee, 'myevent');
* } catch (err) {
* console.log('error happened', err);
* }
* try {
* await once(ee, 'myevent');
* } catch (err) {
* console.error('error happened', err);
* }
*
* run();
* ```
*
* The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
* The special handling of the `'error'` event is only used when `events.once()` is used to wait for another event. If `events.once()` is used to wait for the
* '`error'` event itself, then it is treated as any other kind of event without
* special handling:
*
* ```js
* const { EventEmitter, once } = require('events');
* import { EventEmitter, once } from 'node:events';
*
* const ee = new EventEmitter();
*
* once(ee, 'error')
* .then(([err]) => console.log('ok', err.message))
* .catch((err) => console.log('error', err.message));
* .catch((err) => console.error('error', err.message));
*
* ee.emit('error', new Error('boom'));
*
@@ -170,7 +208,7 @@ declare module 'events' {
* An `AbortSignal` can be used to cancel waiting for the event:
*
* ```js
* const { EventEmitter, once } = require('events');
* import { EventEmitter, once } from 'node:events';
*
* const ee = new EventEmitter();
* const ac = new AbortController();
@@ -194,29 +232,32 @@ declare module 'events' {
* ```
* @since v11.13.0, v10.16.0
*/
static once(emitter: _NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
static once(
emitter: NodeJS.EventEmitter,
eventName: string | symbol,
options?: Pick<StaticEventEmitterOptions, "signal">,
): Promise<any[]>;
static once(emitter: EventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
/**
* ```js
* const { on, EventEmitter } = require('events');
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* (async () => {
* const ee = new EventEmitter();
* const ee = new EventEmitter();
*
* // Emit later on
* process.nextTick(() => {
* ee.emit('foo', 'bar');
* ee.emit('foo', 42);
* });
* // Emit later on
* process.nextTick(() => {
* ee.emit('foo', 'bar');
* ee.emit('foo', 42);
* });
*
* for await (const event of on(ee, 'foo')) {
* // The execution of this inner block is synchronous and it
* // processes one event at a time (even with await). Do not use
* // if concurrent execution is required.
* console.log(event); // prints ['bar'] [42]
* }
* // Unreachable here
* })();
* for await (const event of on(ee, 'foo')) {
* // The execution of this inner block is synchronous and it
* // processes one event at a time (even with await). Do not use
* // if concurrent execution is required.
* console.log(event); // prints ['bar'] [42]
* }
* // Unreachable here
* ```
*
* Returns an `AsyncIterator` that iterates `eventName` events. It will throw
@@ -227,7 +268,9 @@ declare module 'events' {
* An `AbortSignal` can be used to cancel waiting on events:
*
* ```js
* const { on, EventEmitter } = require('events');
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* const ac = new AbortController();
*
* (async () => {
@@ -250,16 +293,48 @@ declare module 'events' {
*
* process.nextTick(() => ac.abort());
* ```
* @since v13.6.0, v12.16.0
* @param eventName The name of the event being listened for
* @return that iterates `eventName` events emitted by the `emitter`
*/
static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
/**
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
*
* Use the `close` option to specify an array of event names that will end the iteration:
*
* ```js
* const { EventEmitter, listenerCount } = require('events');
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* const ee = new EventEmitter();
*
* // Emit later on
* process.nextTick(() => {
* ee.emit('foo', 'bar');
* ee.emit('foo', 42);
* ee.emit('close');
* });
*
* for await (const event of on(ee, 'foo', { close: ['close'] })) {
* console.log(event); // prints ['bar'] [42]
* }
* // the loop will exit after 'close' is emitted
* console.log('done'); // prints 'done'
* ```
* @since v13.6.0, v12.16.0
* @param eventName The name of the event being listened for
* @return An `AsyncIterator` that iterates `eventName` events emitted by the `emitter`
*/
static on(
emitter: NodeJS.EventEmitter,
eventName: string | symbol,
options?: StaticEventEmitterOptions,
): AsyncIterableIterator<any>;
static on(
emitter: EventTarget,
eventName: string,
options?: StaticEventEmitterIteratorOptions,
): AsyncIterableIterator<any>;
/**
* A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`.
*
* ```js
* import { EventEmitter, listenerCount } from 'node:events';
*
* const myEmitter = new EventEmitter();
* myEmitter.on('event', () => {});
* myEmitter.on('event', () => {});
@@ -282,30 +357,56 @@ declare module 'events' {
* event target. This is useful for debugging and diagnostic purposes.
*
* ```js
* const { getEventListeners, EventEmitter } = require('events');
* import { getEventListeners, EventEmitter } from 'node:events';
*
* {
* const ee = new EventEmitter();
* const listener = () => console.log('Events are fun');
* ee.on('foo', listener);
* getEventListeners(ee, 'foo'); // [listener]
* console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
* }
* {
* const et = new EventTarget();
* const listener = () => console.log('Events are fun');
* et.addEventListener('foo', listener);
* getEventListeners(et, 'foo'); // [listener]
* console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
* }
* ```
* @since v15.2.0, v14.17.0
*/
static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
static getEventListeners(emitter: EventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
/**
* Returns the currently set max amount of listeners.
*
* For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
* the emitter.
*
* For `EventTarget`s this is the only way to get the max event listeners for the
* event target. If the number of event handlers on a single EventTarget exceeds
* the max set, the EventTarget will print a warning.
*
* ```js
* import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
*
* {
* const ee = new EventEmitter();
* console.log(getMaxListeners(ee)); // 10
* setMaxListeners(11, ee);
* console.log(getMaxListeners(ee)); // 11
* }
* {
* const et = new EventTarget();
* console.log(getMaxListeners(et)); // 10
* setMaxListeners(11, et);
* console.log(getMaxListeners(et)); // 11
* }
* ```
* @since v19.9.0
*/
static getMaxListeners(emitter: EventTarget | NodeJS.EventEmitter): number;
/**
* ```js
* const {
* setMaxListeners,
* EventEmitter
* } = require('events');
* import { setMaxListeners, EventEmitter } from 'node:events';
*
* const target = new EventTarget();
* const emitter = new EventEmitter();
@@ -317,26 +418,105 @@ declare module 'events' {
* @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
* objects.
*/
static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
static setMaxListeners(n?: number, ...eventTargets: Array<EventTarget | NodeJS.EventEmitter>): void;
/**
* This symbol shall be used to install a listener for only monitoring `'error'`
* events. Listeners installed using this symbol are called before the regular
* `'error'` listeners are called.
* Listens once to the `abort` event on the provided `signal`.
*
* Installing a listener using this symbol does not change the behavior once an
* `'error'` event is emitted, therefore the process will still crash if no
* Listening to the `abort` event on abort signals is unsafe and may
* lead to resource leaks since another third party with the signal can
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
* this since it would violate the web standard. Additionally, the original
* API makes it easy to forget to remove listeners.
*
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
* two issues by listening to the event such that `stopImmediatePropagation` does
* not prevent the listener from running.
*
* Returns a disposable so that it may be unsubscribed from more easily.
*
* ```js
* import { addAbortListener } from 'node:events';
*
* function example(signal) {
* let disposable;
* try {
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
* disposable = addAbortListener(signal, (e) => {
* // Do something when signal is aborted.
* });
* } finally {
* disposable?.[Symbol.dispose]();
* }
* }
* ```
* @since v20.5.0
* @experimental
* @return Disposable that removes the `abort` listener.
*/
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
/**
* This symbol shall be used to install a listener for only monitoring `'error'` events. Listeners installed using this symbol are called before the regular `'error'` listeners are called.
*
* Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted. Therefore, the process will still crash if no
* regular `'error'` listener is installed.
* @since v13.6.0, v12.17.0
*/
static readonly errorMonitor: unique symbol;
/**
* Value: `Symbol.for('nodejs.rejection')`
*
* See how to write a custom `rejection handler`.
* @since v13.4.0, v12.16.0
*/
static readonly captureRejectionSymbol: unique symbol;
/**
* Sets or gets the default captureRejection value for all emitters.
* Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
*
* Change the default `captureRejections` option on all new `EventEmitter` objects.
* @since v13.4.0, v12.16.0
*/
// TODO: These should be described using static getter/setter pairs:
static captureRejections: boolean;
/**
* By default, a maximum of `10` listeners can be registered for any single
* event. This limit can be changed for individual `EventEmitter` instances
* using the `emitter.setMaxListeners(n)` method. To change the default
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners` property
* can be used. If this value is not a positive number, a `RangeError` is thrown.
*
* Take caution when setting the `events.defaultMaxListeners` because the
* change affects _all_ `EventEmitter` instances, including those created before
* the change is made. However, calling `emitter.setMaxListeners(n)` still has
* precedence over `events.defaultMaxListeners`.
*
* This is not a hard limit. The `EventEmitter` instance will allow
* more listeners to be added but will output a trace warning to stderr indicating
* that a "possible EventEmitter memory leak" has been detected. For any single
* `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()` methods can be used to
* temporarily avoid this warning:
*
* ```js
* import { EventEmitter } from 'node:events';
* const emitter = new EventEmitter();
* emitter.setMaxListeners(emitter.getMaxListeners() + 1);
* emitter.once('event', () => {
* // do stuff
* emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
* });
* ```
*
* The `--trace-warnings` command-line flag can be used to display the
* stack trace for such warnings.
*
* The emitted warning can be inspected with `process.on('warning')` and will
* have the additional `emitter`, `type`, and `count` properties, referring to
* the event emitter instance, the event's name and the number of attached
* listeners, respectively.
* Its `name` property is set to `'MaxListenersExceededWarning'`.
* @since v0.11.2
*/
static defaultMaxListeners: number;
}
import internal = require('node:events');
import internal = require("node:events");
namespace EventEmitter {
// Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
export { internal as EventEmitter };
@@ -346,20 +526,99 @@ declare module 'events' {
*/
signal?: AbortSignal | undefined;
}
export interface EventEmitterReferencingAsyncResource extends AsyncResource {
readonly eventEmitter: EventEmitterAsyncResource;
}
export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
/**
* The type of async event, this is required when instantiating `EventEmitterAsyncResource`
* directly rather than as a child class.
* @default new.target.name if instantiated as a child class.
*/
name?: string;
}
/**
* Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that
* require manual async tracking. Specifically, all events emitted by instances
* of `events.EventEmitterAsyncResource` will run within its `async context`.
*
* ```js
* import { EventEmitterAsyncResource, EventEmitter } from 'node:events';
* import { notStrictEqual, strictEqual } from 'node:assert';
* import { executionAsyncId, triggerAsyncId } from 'node:async_hooks';
*
* // Async tracking tooling will identify this as 'Q'.
* const ee1 = new EventEmitterAsyncResource({ name: 'Q' });
*
* // 'foo' listeners will run in the EventEmitters async context.
* ee1.on('foo', () => {
* strictEqual(executionAsyncId(), ee1.asyncId);
* strictEqual(triggerAsyncId(), ee1.triggerAsyncId);
* });
*
* const ee2 = new EventEmitter();
*
* // 'foo' listeners on ordinary EventEmitters that do not track async
* // context, however, run in the same async context as the emit().
* ee2.on('foo', () => {
* notStrictEqual(executionAsyncId(), ee2.asyncId);
* notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId);
* });
*
* Promise.resolve().then(() => {
* ee1.emit('foo');
* ee2.emit('foo');
* });
* ```
*
* The `EventEmitterAsyncResource` class has the same methods and takes the
* same options as `EventEmitter` and `AsyncResource` themselves.
* @since v17.4.0, v16.14.0
*/
export class EventEmitterAsyncResource extends EventEmitter {
/**
* @param options Only optional in child class.
*/
constructor(options?: EventEmitterAsyncResourceOptions);
/**
* Call all `destroy` hooks. This should only ever be called once. An error will
* be thrown if it is called more than once. This **must** be manually called. If
* the resource is left to be collected by the GC then the `destroy` hooks will
* never be called.
*/
emitDestroy(): void;
/**
* The unique `asyncId` assigned to the resource.
*/
readonly asyncId: number;
/**
* The same triggerAsyncId that is passed to the AsyncResource constructor.
*/
readonly triggerAsyncId: number;
/**
* The returned `AsyncResource` object has an additional `eventEmitter` property
* that provides a reference to this `EventEmitterAsyncResource`.
*/
readonly asyncResource: EventEmitterReferencingAsyncResource;
}
}
global {
namespace NodeJS {
interface EventEmitter {
interface EventEmitter<T extends EventMap<T> = DefaultEventMap> {
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: Key<K, T>, ...args: Args<K, T>): void;
/**
* Alias for `emitter.on(eventName, listener)`.
* @since v0.1.26
*/
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
addListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
/**
* Adds the `listener` function to the end of the listeners array for the
* event named `eventName`. No checks are made to see if the `listener` has
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
* times.
* Adds the `listener` function to the end of the listeners array for the event
* named `eventName`. No checks are made to see if the `listener` has already
* been added. Multiple calls passing the same combination of `eventName` and
* `listener` will result in the `listener` being added, and called, multiple times.
*
* ```js
* server.on('connection', (stream) => {
@@ -369,10 +628,11 @@ declare module 'events' {
*
* Returns a reference to the `EventEmitter`, so that calls can be chained.
*
* By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
* By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the
* event listener to the beginning of the listeners array.
*
* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();
* myEE.on('foo', () => console.log('a'));
* myEE.prependListener('foo', () => console.log('b'));
@@ -385,9 +645,9 @@ declare module 'events' {
* @param eventName The name of the event.
* @param listener The callback function
*/
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
/**
* Adds a **one-time**`listener` function for the event named `eventName`. The
* Adds a **one-time** `listener` function for the event named `eventName`. The
* next time `eventName` is triggered, this listener is removed and then invoked.
*
* ```js
@@ -398,10 +658,11 @@ declare module 'events' {
*
* Returns a reference to the `EventEmitter`, so that calls can be chained.
*
* By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
* By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the
* event listener to the beginning of the listeners array.
*
* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();
* myEE.once('foo', () => console.log('a'));
* myEE.prependOnceListener('foo', () => console.log('b'));
@@ -414,9 +675,9 @@ declare module 'events' {
* @param eventName The name of the event.
* @param listener The callback function
*/
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
/**
* Removes the specified `listener` from the listener array for the event named`eventName`.
* Removes the specified `listener` from the listener array for the event named `eventName`.
*
* ```js
* const callback = (stream) => {
@@ -433,10 +694,12 @@ declare module 'events' {
* called multiple times to remove each instance.
*
* Once an event is emitted, all listeners attached to it at the
* time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
* time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
* will not remove them from`emit()` in progress. Subsequent events behave as expected.
*
* ```js
* import { EventEmitter } from 'node:events';
* class MyEmitter extends EventEmitter {}
* const myEmitter = new MyEmitter();
*
* const callbackA = () => {
@@ -474,9 +737,10 @@ declare module 'events' {
*
* When a single function has been added as a handler multiple times for a single
* event (as in the example below), `removeListener()` will remove the most
* recently added instance. In the example the `once('ping')`listener is removed:
* recently added instance. In the example the `once('ping')` listener is removed:
*
* ```js
* import { EventEmitter } from 'node:events';
* const ee = new EventEmitter();
*
* function pong() {
@@ -494,12 +758,12 @@ declare module 'events' {
* Returns a reference to the `EventEmitter`, so that calls can be chained.
* @since v0.1.26
*/
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
removeListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
/**
* Alias for `emitter.removeListener()`.
* @since v10.0.0
*/
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
off<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
/**
* Removes all listeners, or those of the specified `eventName`.
*
@@ -510,12 +774,12 @@ declare module 'events' {
* Returns a reference to the `EventEmitter`, so that calls can be chained.
* @since v0.1.26
*/
removeAllListeners(event?: string | symbol): this;
removeAllListeners(eventName?: Key<unknown, T>): this;
/**
* By default `EventEmitter`s will print a warning if more than `10` listeners are
* added for a particular event. This is a useful default that helps finding
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
* modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
* modified for this specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) to indicate an unlimited number of listeners.
*
* Returns a reference to the `EventEmitter`, so that calls can be chained.
* @since v0.3.5
@@ -539,12 +803,13 @@ declare module 'events' {
* ```
* @since v0.1.26
*/
listeners(eventName: string | symbol): Function[];
listeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
/**
* Returns a copy of the array of listeners for the event named `eventName`,
* including any wrappers (such as those created by `.once()`).
*
* ```js
* import { EventEmitter } from 'node:events';
* const emitter = new EventEmitter();
* emitter.once('log', () => console.log('log once'));
*
@@ -569,15 +834,15 @@ declare module 'events' {
* ```
* @since v9.4.0
*/
rawListeners(eventName: string | symbol): Function[];
rawListeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
/**
* Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
* Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments
* to each.
*
* Returns `true` if the event had listeners, `false` otherwise.
*
* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
* const myEmitter = new EventEmitter();
*
* // First listener
@@ -610,18 +875,21 @@ declare module 'events' {
* ```
* @since v0.1.26
*/
emit(eventName: string | symbol, ...args: any[]): boolean;
emit<K>(eventName: Key<K, T>, ...args: Args<K, T>): boolean;
/**
* Returns the number of listeners listening to the event named `eventName`.
* Returns the number of listeners listening for the event named `eventName`.
* If `listener` is provided, it will return how many times the listener is found
* in the list of the listeners of the event.
* @since v3.2.0
* @param eventName The name of the event being listened for
* @param listener The event handler function
*/
listenerCount(eventName: string | symbol): number;
listenerCount<K>(eventName: Key<K, T>, listener?: Listener2<K, T>): number;
/**
* Adds the `listener` function to the _beginning_ of the listeners array for the
* event named `eventName`. No checks are made to see if the `listener` has
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
* times.
* already been added. Multiple calls passing the same combination of `eventName`
* and `listener` will result in the `listener` being added, and called, multiple times.
*
* ```js
* server.prependListener('connection', (stream) => {
@@ -634,7 +902,7 @@ declare module 'events' {
* @param eventName The name of the event.
* @param listener The callback function
*/
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
/**
* Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
* listener is removed, and then invoked.
@@ -650,13 +918,14 @@ declare module 'events' {
* @param eventName The name of the event.
* @param listener The callback function
*/
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
/**
* Returns an array listing the events for which the emitter has registered
* listeners. The values in the array are strings or `Symbol`s.
*
* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
*
* const myEE = new EventEmitter();
* myEE.on('foo', () => {});
* myEE.on('bar', () => {});
@@ -669,13 +938,13 @@ declare module 'events' {
* ```
* @since v6.0.0
*/
eventNames(): Array<string | symbol>;
eventNames(): Array<(string | symbol) & Key2<unknown, T>>;
}
}
}
export = EventEmitter;
}
declare module 'node:events' {
import events = require('events');
declare module "node:events" {
import events = require("events");
export = events;
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More