1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

More api documentation updates

This commit is contained in:
Nick O'Leary 2019-01-28 14:40:24 +00:00
parent 2e063f91bc
commit e0bb03a53f
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
7 changed files with 109 additions and 4 deletions

View File

@ -2,7 +2,31 @@
Runtime
- Bump JSONata to 1.6.5
- Bump JSONata to 1.6.4
- Add Flow.getSetting for resolving env-var properties
- Refactor Subflow logic into own class
- Restore RED.auth to node-red module api
- Tidy up when usage in Flow and Node
Editor
- German translation
- Change default dropdown appearance and sidebar tab menu handling
- Handle multiple-select box when nothing selected Fixes #2021
- Handle i18n properly when key is a valid sub-identifier Fixes #2028
- Avoid duplicate links when missing node type installed Fixes #2032
- Add View Tools
- Don't collapse version control header when clicking refresh
- Add fast entry via keyboard for string of nodes
- Check for undeployed change before showing open project dialog
- Add placeholder node when in quick-add mode
- Move nodes to top-left corner when converting to subflow
Nodes
- Debug: Allow debug edit expression to be sent to status
- WebSocket: Fix missing translated help
#### 0.20.0-beta.3: Beta Release

View File

@ -443,6 +443,8 @@ module.exports = function(grunt) {
'packages/node_modules/@node-red/runtime/lib/api/*.js',
'packages/node_modules/@node-red/runtime/lib/events.js',
'packages/node_modules/@node-red/util/**/*.js',
'packages/node_modules/@node-red/editor-api/lib/index.js',
'packages/node_modules/@node-red/editor-api/lib/auth/index.js'
],
options: {
destination: 'docs',

View File

@ -15,7 +15,6 @@
},
"templates": {
"systemName": "Node-RED Runtime API",
"theme":"yeti",
"footer": "",
"copyright": "Released under the Apache License v2.0",
"default": {

View File

@ -14,6 +14,11 @@
* limitations under the License.
**/
/**
* @mixin @node-red/editor-api_auth
*/
var passport = require("passport");
var oauth2orize = require("oauth2orize");
@ -44,7 +49,14 @@ function init(_settings,storage) {
Tokens.init(mergedAdminAuth,storage);
}
}
/**
* Returns an Express middleware function that ensures the user making a request
* has the necessary permission.
*
* @param {String} permission - the permission required for the request, such as `flows.write`
* @return {Function} - an Express middleware
* @memberof @node-red/editor-api_auth
*/
function needsPermission(permission) {
return function(req,res,next) {
if (settings && settings.adminAuth) {

View File

@ -14,6 +14,16 @@
* limitations under the License.
**/
/**
* This module provides an Express application to serve the Node-RED editor.
*
* It implements the Node-RED HTTP Admin API the Editor uses to interact
* with the Node-RED runtime.
*
* @namespace @node-red/editor-api
*/
var express = require("express");
var bodyParser = require("body-parser");
var util = require('util');
@ -28,6 +38,15 @@ var adminApp;
var server;
var editor;
/**
* Initialise the module.
* @param {Object} settings The runtime settings
* @param {HTTPServer} server An instance of HTTP Server
* @param {Storage} storage An instance of Node-RED Storage
* @param {Runtime} runtimeAPI An instance of Node-RED Runtime
* @memberof @node-red/editor-api
*/
function init(settings,_server,storage,runtimeAPI) {
server = _server;
if (settings.httpAdminRoot !== false) {
@ -80,6 +99,12 @@ function init(settings,_server,storage,runtimeAPI) {
adminApp = null;
}
}
/**
* Start the module.
* @return {Promise} resolves when the application is ready to handle requests
* @memberof @node-red/editor-api
*/
function start() {
if (editor) {
return editor.start();
@ -87,6 +112,12 @@ function start() {
return when.resolve();
}
}
/**
* Stop the module.
* @return {Promise} resolves when the application is stopped
* @memberof @node-red/editor-api
*/
function stop() {
if (editor) {
editor.stop();
@ -97,8 +128,18 @@ module.exports = {
init: init,
start: start,
stop: stop,
/**
* @memberof @node-red/editor-api
* @mixes @node-red/editor-api_auth
*/
auth: {
needsPermission: auth.needsPermission
},
/**
* The Express app used to serve the Node-RED Editor
* @type ExpressApplication
* @memberof @node-red/editor-api
*/
get httpAdmin() { return adminApp; }
};

View File

@ -14,6 +14,16 @@
* limitations under the License.
**/
/**
* This module provides the node registry for the Node-RED runtime.
*
* It is responsible for loading node modules and making them available
* to the runtime.
*
* @namespace @node-red/registry
*/
var registry = require("./registry");
var loader = require("./loader");
var installer = require("./installer");

View File

@ -122,6 +122,13 @@ module.exports = {
*/
util: redUtil.util,
/**
* This provides access to the internal nodes module of the
* runtime.
*
* @memberof node-red
*/
get nodes() { return runtime._.nodes },
/**
@ -131,6 +138,12 @@ module.exports = {
*/
events: runtime.events,
/**
* This provides access to the internal settings module of the
* runtime.
*
* @memberof node-red
*/
get settings() { return runtime._.settings },
@ -145,18 +158,21 @@ module.exports = {
/**
* The express application for the Editor Admin API
* @type ExpressApplication
* @memberof node-red
*/
get httpAdmin() { return api.httpAdmin },
/**
* The express application for HTTP Nodes
* @type ExpressApplication
* @memberof node-red
*/
get httpNode() { return runtime.httpNode },
/**
* The HTTP Server used by the runtime
* @type HTTPServer
* @memberof node-red
*/
get server() { return server },
@ -170,6 +186,7 @@ module.exports = {
/**
* The editor authentication api.
* @see @node-red/editor-api_auth
* @memberof node-red
*/
auth: api.auth