Skip to content

Commit

Permalink
More api documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Jan 28, 2019
1 parent 2e063f9 commit e0bb03a
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 4 deletions.
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,9 @@ 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',
configure: './jsdoc.json'
Expand Down
1 change: 0 additions & 1 deletion jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"templates": {
"systemName": "Node-RED Runtime API",
"theme":"yeti",
"footer": "",
"copyright": "Released under the Apache License v2.0",
"default": {
Expand Down
14 changes: 13 additions & 1 deletion packages/node_modules/@node-red/editor-api/lib/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* limitations under the License.
**/


/**
* @mixin @node-red/editor-api_auth
*/

var passport = require("passport");
var oauth2orize = require("oauth2orize");

Expand Down Expand Up @@ -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) {
Expand Down
41 changes: 41 additions & 0 deletions packages/node_modules/@node-red/editor-api/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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) {
Expand Down Expand Up @@ -80,13 +99,25 @@ 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();
} else {
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();
Expand All @@ -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; }
};
10 changes: 10 additions & 0 deletions packages/node_modules/@node-red/registry/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
17 changes: 17 additions & 0 deletions packages/node_modules/node-red/lib/red.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },

/**
Expand All @@ -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 },


Expand All @@ -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 },
Expand All @@ -170,6 +186,7 @@ module.exports = {

/**
* The editor authentication api.
* @see @node-red/editor-api_auth
* @memberof node-red
*/
auth: api.auth
Expand Down

0 comments on commit e0bb03a

Please sign in to comment.