OpenVeo Core server

API Docs for: 7.0.0
Show:

pluginLoader

Summary

Provides functions to load openveo plugins.

Item Index

Methods

Methods

filterPluginsPaths

Syntax

filterPluginsPaths

(
  • pluginsPaths
)
Array private static

Summary

Filters the list of plugins paths in case the same plugin appears multiple time at different paths. Filters to keep only the most top level one.

Parameters:

  • pluginsPaths Array

    The list of plugins paths to analyze

Returns:

Array:

The filtered list of plugins paths

Example:

var pluginsPaths = [
  '/openveo/node_modules/@openveo/plugin1',
  '/openveo/node_modules/@openveo/plugin2/node_modules/@openveo/plugin1'
];
console.log(filterPluginsPaths(pluginsPaths));
// [ '/openveo/node_modules/@openveo/plugin1' ]

getPluginPaths

Syntax

getPluginPaths

(
  • startingPath
  • callback
)
static

Summary

Recursively and asynchronously analyze the given directory to get npm plugins.

There are two kinds of plugins : plugins maintained by the core team (under @openveo scope) and contributers' plugins which must be prefixed by openveo-.

Parameters:

  • startingPath String

    Root path of an NPM module from where looking for plugins

  • callback Function

    A callback with two arguments :

    • Error An Error object or null
    • Array The list of plugins paths

Example:

getPluginPaths('/openveo', function(error, pluginsPaths){
  console.log(pluginsPaths);
  // [
  //   '/openveo/node_modules/@openveo/plugin',
  //   '/openveo/node_modules/openveo-contrib-plugin'
  // ]
};

loadPlugin

Syntax

loadPlugin

(
  • pluginPath
  • callback
)
static async

Summary

Loads a single plugin by its path.

Parameters:

  • pluginPath String

    Absolute path to the plugin directory

  • callback Function

    A callback with two arguments :

    • Error An Error object or null
    • Plugin The loaded plugin or null

Example:

var pluginLoader = process.require('app/server/loaders/pluginLoader.js');

// Load a plugin
pluginLoader.loadPlugin('/node_modules/@openveo/publish', function(error, loadedPlugin){
  console.log(loadedPlugin);
}

loadPluginMetadata

Syntax

loadPluginMetadata

(
  • plugin
  • callback
)
static async

Summary

Loads plugin's configuration.

Parameters:

  • plugin Plugin

    The plugin

  • callback Function

    A callback with :

    • Error An Error if something went wrong

loadPlugins

Syntax

loadPlugins

(
  • startingPath
  • callback
)
static async

Summary

Recursively and asynchronously load all offical and contributed OpenVeo plugins under the given path.

If the same plugin (same name) is encountered several times, the top level one will be kept.

Parameters:

  • startingPath String

    Root path of an NPM module from where looking for plugins

  • callback Function

    A callback with two arguments :

    • Error An Error object or null
    • Array A list of Plugin objects

Example:

var pluginLoader = process.require('app/server/loaders/pluginLoader.js');

// Load all potential openveo plugins from directory /home/openveo/openveo
pluginLoader.loadPlugins('/home/openveo/openveo', function(error, plugins){
  console.log(plugins);
};