mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add credential registration to RED.nodes.registerType
This commit is contained in:
parent
f80c41058c
commit
a6a0352b70
@ -18,6 +18,18 @@ var credentials = require("./credentials");
|
||||
var flows = require("./flows");
|
||||
var Node = require("./Node");
|
||||
|
||||
/**
|
||||
* Registers a node constructor
|
||||
* @param type - the string type name
|
||||
* @param constructor - the constructor function for this node type
|
||||
* @param opts - optional additional options for the node
|
||||
*/
|
||||
function registerType(type,constructor,opts) {
|
||||
if (opts && opts.credentials) {
|
||||
credentials.register(type,opts.credentials);
|
||||
}
|
||||
registry.registerType(type,constructor);
|
||||
}
|
||||
|
||||
function createNode(node,def) {
|
||||
Node.call(node,def);
|
||||
@ -33,11 +45,10 @@ function init(_settings,storage) {
|
||||
module.exports = {
|
||||
init: init,
|
||||
load: registry.load,
|
||||
addCredentials: credentials.add,
|
||||
getCredentials: credentials.get,
|
||||
deleteCredentials: credentials.delete,
|
||||
|
||||
createNode: createNode,
|
||||
registerType: registry.registerType,
|
||||
registerType: registerType,
|
||||
|
||||
getType: registry.get,
|
||||
getNodeConfigs: registry.getNodeConfigs,
|
||||
getNode: flows.get,
|
||||
@ -45,6 +56,11 @@ module.exports = {
|
||||
loadFlows: flows.load,
|
||||
stopFlows: flows.stopFlows,
|
||||
setFlows: flows.setFlows,
|
||||
getFlows: flows.getFlows
|
||||
getFlows: flows.getFlows,
|
||||
|
||||
// TODO: remove these from api - see #93
|
||||
addCredentials: credentials.add,
|
||||
getCredentials: credentials.get,
|
||||
deleteCredentials: credentials.delete
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user