AdaptFrameworkImport

adaptframework. AdaptFrameworkImport

Handles the Adapt framework import process

Constructor

new AdaptFrameworkImport()

Source:

Members

assetData :Array

Description:
  • List of asset metadata
Source:
List of asset metadata
Type:
  • Array

assetFolders :Array.<String>

Description:
  • List of asset folders to check
Source:
List of asset folders to check
Type:
  • Array.<String>

assetMap :Object

Description:
  • A key/value map of asset file names to new asset ids
Source:
A key/value map of asset file names to new asset ids
Type:
  • Object

assets :AssetsModule

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

componentNameMap :Object

Description:
  • Key/value store mapping old component keys to component names
Source:
Key/value store mapping old component keys to component names
Type:
  • Object

content :ContentModule

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

contentJson :Object

Description:
  • A cache of the import's content JSON file data (note this is not the DB data used by the application)
Source:
A cache of the import's content JSON file data (note this is not the DB data used by the application)
Type:
  • Object

contentplugin :ContentPluginModule

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

coursePath :String

Description:
  • Path to the import course folder
Source:
Path to the import course folder
Type:
  • String

courseassets :CourseAssetsModule

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

framework :AdaptFrameworkModule

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

idMap :Object

Description:
  • A key/value map of old ids to new ids
Source:
A key/value map of old ids to new ids
Type:
  • Object

jsonschema :JsonSchemaModule

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

newContentPlugins :Object

Description:
  • All plugins installed during the import as a name -> metadata map
Source:
All plugins installed during the import as a name -> metadata map
Type:
  • Object

pkg :Object

Description:
  • Reference to the package.json data
Source:
Reference to the package.json data
Type:
  • Object

settings :Object

Description:
  • User-defined settings related to what is included with the import
Source:
User-defined settings related to what is included with the import
Type:
  • Object

statusReport :Object

Description:
  • Contains non-fatal infomation messages regarding import status which can be return as response data. Fatal errors are thrown in the usual way.
Source:
Contains non-fatal infomation messages regarding import status which can be return as response data. Fatal errors are thrown in the usual way.
Type:
  • Object

tags :Array.<String>

Description:
  • List of tags to apply to the course
Source:
List of tags to apply to the course
Type:
  • Array.<String>

unzipPath :String

Description:
  • Path that the import will be unzipped to
Source:
Path that the import will be unzipped to
Type:
  • String

usedContentPlugins :Object

Description:
  • Key/value store of the installed content plugins
Source:
Key/value store of the installed content plugins
Type:
  • Object

userId :String

Description:
  • The _id of the user initiating the import
Source:
The _id of the user initiating the import
Type:
  • String

Methods

(async) cleanUp(error) → {Promise}

Description:
  • Performs necessary clean-up tasks
Source:
Parameters:
Name Type Description
error Error | Boolean If param is truthy, extra error-related clean-up tasks are performed
Returns:
Type
Promise

(async) convertSchemas() → {Promise}

Description:
  • Converts all properties.schema files to a valid JSON schema format
Source:
Returns:
Type
Promise

extractAssets(schema, data)

Description:
  • Infers the presence of any assets in incoming JSON data
Source:
Parameters:
Name Type Description
schema Object Schema for the passed data
data Object Data to check

getSortedData() → {Array.<Array.<String>>}

Description:
  • Sorts the import content objects into a 2D array separating each 'level' of siblings to allow processing without the need to work out whether the parent object exists.
Source:
Returns:
The sorted list
Type
Array.<Array.<String>>

(async) import() → {Promise}

Description:
  • Imports a course zip to the database
Source:
Returns:
Resolves with the current import instance
Type
Promise

(async) importContentObject() → {Object|Promise}

Description:
  • Imports a single content object
Source:
Returns:
  • The data to be imported
    Type
    Object
  • Resolves with the created document
    Type
    Promise

(async) importCourseAssets() → {Promise}

Description:
  • Imports course asset files
Source:
Returns:
Type
Promise

(async) importCourseData() → {Promise}

Description:
  • Imports all course content data
Source:
Returns:
Type
Promise

(async) importCoursePlugins() → {Promise}

Description:
  • Imports course content plugins
Source:
Returns:
Type
Promise

(async) importTags() → {Promise}

Description:
  • Imports any specified tags
Source:
Returns:
Type
Promise

(async) loadAssetData() → {Promise}

Description:
  • Loads and caches all asset data either manually or using the assets.json file
Source:
Returns:
Type
Promise

(async) loadContentFile() → {Promise}

Description:
  • Loads a single content JSON file
Source:
Returns:
Type
Promise

(async) loadCourseData() → {Promise}

Description:
  • Loads and caches all course content
Source:
Returns:
Type
Promise

(async) prepare() → {Promise}

Description:
  • Performs preliminary checks to confirm that a course is suitable for import
Source:
Returns:
Type
Promise

(async) transformData(data) → {Promise}

Description:
  • Performs custom data transforms prior to import
Source:
Parameters:
Name Type Description
data Object Data to transform
Returns:
Resolves with the transformed data
Type
Promise

(async, static) run(options) → {Promise.<AdaptFrameworkImport>}

Description:
  • Runs the import
Source:
Parameters:
Name Type Description
options AdaptFrameworkImportOptions
Returns:
Type
Promise.<AdaptFrameworkImport>

(static) typeToSchema(data) → {String}

Description:
  • Returns the schema to be used for a specific content type
Source:
Parameters:
Name Type Description
data Object The content item
Returns:
The schema name
Type
String