AdaptFrameworkBuild

adaptframework. AdaptFrameworkBuild

Encapsulates all behaviour needed to build a single Adapt course instance

Constructor

new AdaptFrameworkBuild()

Source:

Members

action :String

Description:
  • The build action being performed
Source:
The build action being performed
Type:
  • String

assetData :Object

Description:
  • All metadata related to assets used in this course
Source:
All metadata related to assets used in this course
Type:
  • Object

buildData :Object

Description:
  • Metadata describing this build attempt
Source:
Metadata describing this build attempt
Type:
  • Object

buildDir :String

Description:
  • The course build directory
Source:
The course build directory
Type:
  • String

collectionName :String

Description:
  • The MongoDB collection name
Source:
The MongoDB collection name
Type:
  • String

courseData :Object

Description:
  • All JSON data describing this course
Source:
All JSON data describing this course
Type:
  • Object

courseDir :String

Description:
  • The course content directory
Source:
The course content directory
Type:
  • String

courseId :String

Description:
  • The _id of the course being build
Source:
The _id of the course being build
Type:
  • String

dir :String

Description:
  • The build output directory
Source:
The build output directory
Type:
  • String

disabledPlugins :Array.<Object>

Description:
  • List of plugins NOT used in this course
Source:
List of plugins NOT used in this course
Type:
  • Array.<Object>

enabledPlugins :Array.<Object>

Description:
  • List of plugins used in this course
Source:
List of plugins used in this course
Type:
  • Array.<Object>

expiresAt :Object

Description:
  • All JSON data describing this course
Source:
All JSON data describing this course
Type:
  • Object

idMap :Object

Description:
  • A map of _ids for use with 'friendly' IDs
Source:
A map of _ids for use with 'friendly' IDs
Type:
  • Object

isExport :Boolean

Description:
  • Shorthand for checking if this build is an export
Source:
Shorthand for checking if this build is an export
Type:
  • Boolean

isPreview :Boolean

Description:
  • Shorthand for checking if this build is a preview
Source:
Shorthand for checking if this build is a preview
Type:
  • Boolean

isPublish :Boolean

Description:
  • Shorthand for checking if this build is a publish
Source:
Shorthand for checking if this build is a publish
Type:
  • Boolean

location :String

Description:
  • The final location of the build
Source:
The final location of the build
Type:
  • String

postBuildHook :Hook

Description:
  • Invoked after a course has been built.
Source:
Invoked after a course has been built.
Type:
  • Hook

preBuildHook :Hook

Description:
  • Invoked prior to a course being built.
Source:
Invoked prior to a course being built.
Type:
  • Hook

userId :String

Description:
  • _id of the user initiating the course build
Source:
_id of the user initiating the course build
Type:
  • String

Methods

(async) build() → {Promise}

Description:
  • Runs the Adapt framework build tools to generate a course build
Source:
Returns:
Resolves with the output directory
Type
Promise

(async) cachePluginData() → {Promise}

Description:
  • Caches lists of which plugins are/aren't being used in this course
Source:
Returns:
Type
Promise

(async) copyAssets() → {Promise}

Description:
  • Deals with copying all assets used in this course
Source:
Returns:
Type
Promise

(async) copySource() → {Promise}

Description:
  • Copies the source code needed for this course
Source:
Returns:
Type
Promise

createIdMap()

Description:
  • Stores a map of friendlyId values to ObjectId _ids
Source:

(async) createPreview() → {Promise}

Description:
  • Makes sure the output folder is structured to allow the files to be served statically for previewing
Source:
Returns:
Type
Promise

(async) createZip() → {Promise}

Description:
  • Creates a zip file containing all files relevant to the type of build being performed
Source:
Returns:
Type
Promise

(async) ensureDir(dir)

Description:
  • Makes sure the directory exists
Source:
Parameters:
Name Type Description
dir string

(async) loadAssetData() → {Promise}

Description:
  • Processes and caches the course's assets
Source:
Returns:
Type
Promise

(async) loadCourseData() → {Promise}

Description:
  • Collects and caches all the DB data for the course being built
Source:
Returns:
Type
Promise

(async) recordBuildAttempt() → {Promise}

Description:
  • Stored metadata about a build attempt in the DB
Source:
Returns:
Resolves with the DB document
Type
Promise

(async) removeOldBuilds() → {Promise}

Description:
  • Removes all previous builds of this.action type
Source:
Returns:
Type
Promise

sortContentItems(items)

Description:
  • Sorts the course data into the types needed for each Adapt JSON file. Works by memoising items into an object using the relative sort order as a key used for sorting.
Source:
Parameters:
Name Type Description
items Array.<Object> The list of content objects

(async) transformContentItems()

Description:
  • Transforms content items into a format recognised by the Adapt framework
Source:

(async) writeContentJson() → {Promise}

Description:
  • Outputs all course data to the required JSON files
Source:
Returns:
Type
Promise

(async, static) getBuildExpiry() → {String}

Description:
  • Returns a timestring to be used for an adaptbuild expiry
Source:
Returns:
Type
String

(async, static) run(options) → {Promise}

Description:
  • Imports a course zip to the database
Source:
Parameters:
Name Type Description
options AdaptFrameworkBuildOptions
Returns:
Resolves to this AdaptFrameworkBuild instance
Type
Promise