AdaptFrameworkImport

adaptframework. AdaptFrameworkImport

Handles the Adapt framework import process

Constructor

new AdaptFrameworkImport()

Source:

Members

assetData :Array

Source:
List of asset metadata
Type:
  • Array

assetFolders :Array.<String>

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

assetMap :Object

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

assets :AssetsModule

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

componentNameMap :Object

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

content :ContentModule

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

contentJson :Object

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

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

courseassets :CourseAssetsModule

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

coursePath :String

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

framework :AdaptFrameworkModule

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

idMap :Object

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

jsonschema :JsonSchemaModule

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

newContentPlugins :Object

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

pkg :Object

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

settings :Object

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

statusReport :Object

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>

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

unzipPath :String

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

usedContentPlugins :Object

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

userId :String

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

Methods

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

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

(static) typeToSchema(data) → {String}

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

(async) cleanUp(error) → {Promise}

Source:
Performs necessary clean-up tasks
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}

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

extractAssets(schema, data)

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

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

Source:
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.
Returns:
The sorted list
Type
Array.<Array.<String>>

(async) import() → {Promise}

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

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

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

(async) importCourseAssets() → {Promise}

Source:
Imports course asset files
Returns:
Type
Promise

(async) importCourseData() → {Promise}

Source:
Imports all course content data
Returns:
Type
Promise

(async) importCoursePlugins() → {Promise}

Source:
Imports course content plugins
Returns:
Type
Promise

(async) importTags() → {Promise}

Source:
Imports any specified tags
Returns:
Type
Promise

(async) loadAssetData() → {Promise}

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

(async) loadContentFile() → {Promise}

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

(async) loadCourseData() → {Promise}

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

(async) prepare() → {Promise}

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

(async) transformData(data) → {Promise}

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