ContentPluginModule

contentplugin. ContentPluginModule

Abstract module which handles framework plugins

Constructor

new ContentPluginModule()

Source:

Extends

  • AbstractApiModule

Members

cliArgs

Source:
Common arguments to be passed to the CLI

framework :AdaptFrameworkModule

Source:
Cached module instance for easy access
Type:
  • AdaptFrameworkModule

newPlugins :Array

Source:
A list of newly installed plugins
Type:
  • Array

pluginSchemas :Object

Source:
Reference to all content plugin schemas, grouped by plugin
Type:
  • Object

Methods

(async) find()

Source:

getPluginSchemas(pluginName) → {Array}

Source:
Returns all schemas registered by a plugin
Parameters:
Name Type Description
pluginName String Plugin name
Returns:
List of the plugin's registered schemas
Type
Array

(async) getPluginUses(pluginId) → {Promise}

Source:
Retrieves the courses in which a plugin is used
Parameters:
Name Type Description
pluginId String Plugin _id
Returns:
Resolves with an array of course data
Type
Promise

(async) init()

Source:

(async) initPlugins() → {Promise}

Source:
Initialises all framework plugins, from adapt.json and local cache
Returns:
Type
Promise

(async) insertOrUpdate(data, options) → {Promise}

Source:
Inserts a new document or performs an update if matching data already exists
Parameters:
Name Type Description
data Object Data to be sent to the DB
options Object Options to pass to the DB function
Returns:
Resolves with the returned data
Type
Promise

(async) installHandler(req, res, next)

Source:
Express request handler for installing a plugin
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) installPlugin(pluginName, versionOrPath, options)

Source:
Installs a single plugin. Note: this function is called by installPlugins and should not be called directly.
Parameters:
Name Type Description
pluginName String Name of the plugin to install
versionOrPath String The semver-formatted version, or the path to the plugin source
options Object
Properties
Name Type Description
force Boolean Whether the plugin should be 'force' installed if version is lower than the existing
strict Boolean Whether the function should fail on error
Returns:
Resolves with plugin DB data

(async) installPlugins(plugins, options)

Source:
Installs new plugins
Parameters:
Name Type Description
plugins Array.<Array> 2D array of strings in the format [pluginName, versionOrPath]
options Object
Properties
Name Type Description
force Boolean Whether the plugin should be 'force' installed if version is lower than the existing
strict Boolean Whether the function should fail on error

isPluginSchema(schemaName) → {Boolean}

Source:
Returns whether a schema is registered by a plugin
Parameters:
Name Type Description
schemaName String Name of the schema to check
Returns:
Type
Boolean

(async) processPluginFiles(name, sourcePath)

Source:
Ensures local plugin source files are stored in the correct location and structured in an expected way
Parameters:
Name Type Description
name String Name of the plugin to install
sourcePath String The path to the plugin source files
Returns:
Resolves with package data

(async) processPluginSchemas(pluginInfo) → {Promise}

Source:
Loads and processes all installed content plugin schemas
Parameters:
Name Type Description
pluginInfo Array Plugin info data
Returns:
Type
Promise

serveSchema()

Source:

(async) setValues()

Source:

(async) uninstallHandler(req, res, next)

Source:
Express request handler for removing a plugin
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) uninstallPlugin(_id)

Source:
Removes a single plugin
Parameters:
Name Type Description
_id String The _id for the plugin to remove

(async) updateHandler(req, res, next)

Source:
Express request handler for updating a plugin
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) updatePlugin(_id)

Source:
Updates a single plugin
Parameters:
Name Type Description
_id String The _id for the plugin to update
Returns:
Resolves with update data

(async) usesHandler(req, res, next)

Source:
Express request handler for retrieving uses of a single plugin
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function