ContentPluginModule

contentplugin. ContentPluginModule

Abstract module which handles framework plugins

Constructor

new ContentPluginModule()

Source:

Extends

  • AbstractApiModule

Members

cliArgs

Description:
  • Common arguments to be passed to the CLI
Source:
Common arguments to be passed to the CLI

framework :AdaptFrameworkModule

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

newPlugins :Array

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

pluginSchemas :Object

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

Methods

(async) delete()

Source:

(async) find()

Source:

getPluginSchemas(pluginName) → {Array}

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

(async) getPluginUses(pluginId) → {Promise}

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

(async) init()

Source:

(async) initPlugins() → {Promise}

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

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

Description:
  • Inserts a new document or performs an update if matching data already exists
Source:
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)

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

(async) installPlugin(pluginName, versionOrPath, options)

Description:
  • Installs a single plugin. Note: this function is called by installPlugins and should not be called directly.
Source:
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)

Description:
  • Installs new plugins
Source:
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}

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

(async) processPluginFiles(name, sourcePath)

Description:
  • Ensures local plugin source files are stored in the correct location and structured in an expected way
Source:
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}

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

serveSchema()

Source:

(async) setValues()

Source:

(async) updateHandler(req, res, next)

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

(async) updatePlugin(_id)

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

(async) usesHandler(req, res, next)

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