AdaptFrameworkUtils

adaptframework. AdaptFrameworkUtils

Utilities for use with the AdaptFrameworkModule

Constructor

new AdaptFrameworkUtils()

Source:

Methods

(async, static) getHandler(req, res, next) → {Promise}

Description:
  • Handles GET requests to the API
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function
Returns:
Type
Promise

(static) getImportContentCounts(content) → {Object}

Description:
  • Returns a map of content types and their instance count in the content JSON
Source:
Parameters:
Name Type Description
content Object Course content
Returns:
Type
Object

(static) getPluginUpdateStatus(versions, isLocalInstall, updatePlugins) → {String}

Description:
  • Determines the update status code
Source:
Parameters:
Name Type Description
versions Array
isLocalInstall Boolean
updatePlugins Boolean
Returns:
The update status code
Type
String

(async, static) getUpdateHandler(req, res, next) → {Promise}

Description:
  • Handles GET /update requests to the API
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function
Returns:
Type
Promise

(async, static) handleImportFile(req, res) → {Promise}

Description:
  • Deals with an incoming course (supports both local zip and remote URL stream)
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
Returns:
Type
Promise

(async, static) importHandler(req, res, next) → {Promise}

Description:
  • Handles POST /import requests to the API
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function
Returns:
Type
Promise

(static) inferBuildAction(req) → {String}

Description:
  • Infers the framework action to be executed from a given request URL
Source:
Parameters:
Name Type Description
req external:ExpressRequest
Returns:
Type
String

(async, static) postHandler(req, res, next) → {Promise}

Description:
  • Handles POST requests to the API
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function
Returns:
Type
Promise

(async, static) postUpdateHandler(req, res, next) → {Promise}

Description:
  • Handles POST /update requests to the API
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function
Returns:
Type
Promise

(async, static) retrieveBuildData(id) → {Promise}

Description:
  • Retrieves metadata for a build attempt
Source:
Parameters:
Name Type Description
id String ID of build document
Returns:
Type
Promise

(static) toBoolean(val) → {Boolean}

Description:
  • Converts a body value to a valid boolean
Source:
Parameters:
Name Type Description
val *
Returns:
Type
Boolean

Type Definitions

getImportSummary

Source:
Properties:
Name Type Description
title String Course title
courseId String Course _id
statusReport Object Status report
Properties
Name Type Description
info Object.<String> Information messages
warn Array.<String> Warning messages
content Object Object mapping content types to the number of items of that type found in the imported course
versions Object A map of plugins used in the imported course and their versions
Type:
  • AdaptFrameworkImportSummary
Example
{
  adapt_framework: [1.0.0, 2.0.0],
  adapt-contrib-vanilla: [1.0.0, 2.0.0]
}