mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add initial support for ThemePlugins
This commit is contained in:
@@ -9,21 +9,59 @@ var api = module.exports = {
|
||||
runtime = _runtime;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a plugin definition from the registry
|
||||
* @param {Object} opts
|
||||
* @param {String} opts.id - the id of the plugin to get
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {Object} opts.req - the request to log (optional)
|
||||
* @return {Promise<PluginDefinition>} - the plugin definition
|
||||
* @memberof @node-red/runtime_plugins
|
||||
*/
|
||||
getPlugin: async function(opts) {
|
||||
return runtime.plugins.getPlugin(opts.id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets all plugin definitions of a given type
|
||||
* @param {Object} opts
|
||||
* @param {String} opts.type - the type of the plugins to get
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {Object} opts.req - the request to log (optional)
|
||||
* @return {Promise<Array>} - the plugin definitions
|
||||
* @memberof @node-red/runtime_plugins
|
||||
*/
|
||||
getPluginsByType: async function(opts) {
|
||||
return runtime.plugins.getPluginsByType(opts.type);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the editor content for an individual plugin
|
||||
* @param {Object} opts
|
||||
* @param {String} opts.lang - the locale language to return
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {Object} opts.req - the request to log (optional)
|
||||
* @return {Promise<NodeInfo>} - the node information
|
||||
* @memberof @node-red/runtime_nodes
|
||||
* @memberof @node-red/runtime_plugins
|
||||
*/
|
||||
getPluginList: async function(opts) {
|
||||
runtime.log.audit({event: "plugins.list.get"}, opts.req);
|
||||
return runtime.plugins.getPluginList();
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the editor content for all registered plugins
|
||||
* @param {Object} opts
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {Object} opts.req - the request to log (optional)
|
||||
* @return {Promise<NodeInfo>} - the node information
|
||||
* @memberof @node-red/runtime_plugins
|
||||
*/
|
||||
getPluginConfigs: async function(opts) {
|
||||
if (/[^a-z\-]/i.test(opts.lang)) {
|
||||
throw new Error("Invalid language: "+opts.lang)
|
||||
return;
|
||||
}
|
||||
runtime.log.audit({event: "plugins.configs.get"}, opts.req);
|
||||
return runtime.plugins.getPluginConfigs(opts.lang);
|
||||
},
|
||||
@@ -34,7 +72,7 @@ var api = module.exports = {
|
||||
* @param {User} opts.lang - the i18n language to return. If not set, uses runtime default (en-US)
|
||||
* @param {Object} opts.req - the request to log (optional)
|
||||
* @return {Promise<Object>} - the message catalogs
|
||||
* @memberof @node-red/runtime_nodes
|
||||
* @memberof @node-red/runtime_plugins
|
||||
*/
|
||||
getPluginCatalogs: async function(opts) {
|
||||
var lang = opts.lang;
|
||||
|
Reference in New Issue
Block a user