lib/immutable-core-task-instance.js
/**
 * @function initRecord
 *
 * initialize from existing instance record
 *
 * @param {object} args
 */
@function initRecord
initialize from existing instance record

@param {object} args
@function initRecord initialize from existing instance record @param { object } args
async function initRecord (args) {
    this.record = args.record
    var taskId = this.record.data.taskId
    var taskName = this.record.data.taskName
    if (!defined(this.task)) {
        var tasks = ImmutableGlobal.global('ImmutableCoreTask').data.tasks
        this.task = tasks[taskName]
        this.assert(defined(this.task), 113, `${taskName} task not defined`)
        if (taskId !== this.task.taskId) {
            this.task = await this.task.taskById(taskId)
        }
    }
    this.data = this.record.data.data
    this.status = this.record.data.status
    this.lastStepNum = -1
    this.lastSubStep = ''
}
async function initRecord ( args ) { this . record = args . record var taskId = this . record . data . taskId var taskName = this . record . data . taskName if ( ! defined ( this . task ) ) { var tasks = ImmutableGlobal . global ( 'ImmutableCoreTask' ) . data . tasks this . task = tasks [ taskName ] this . assert ( defined ( this . task ) , 113 , ` ${ taskName } ` ) if ( taskId !== this . task . taskId ) { this . task = await this . task . taskById ( taskId ) } } this . data = this . record . data . data this . status = this . record . data . status this . lastStepNum = - 1 this . lastSubStep = '' }
@function initRecord
 initialize from existing instance record
@function initRecord initialize from existing instance record
// store record // get task properties // load task if not already defined // get tasks register from global // get task by name // require task to be defined // if taskId doesnt match need to load correct task // alias data and status to record